Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Video / 2nd Hero Image to Home Layout #1340

Closed
4 tasks done
karlhorky opened this issue Sep 14, 2022 · 10 comments
Closed
4 tasks done

Add Video / 2nd Hero Image to Home Layout #1340

karlhorky opened this issue Sep 14, 2022 · 10 comments
Labels
enhancement New feature or request theme Related to the theme

Comments

@karlhorky
Copy link

karlhorky commented Sep 14, 2022

Is your feature request related to a problem? Please describe.

Currently, the home layout only allows for a single image, which may not be enough for some projects (eg. https://www.safeql.dev/ ), who may want to have one large image and then also a video of the product, both in the upper hero section of the page.

Describe the solution you'd like

It would be nice to have a more customizable / flexible way to output arbitrary (html or markdown) content, eg what I tried with the tagline here:

---
layout: home

hero:
  name: SafeQL
  text: Write SQL Queries With Confidence
  tagline: SafeQL is an ESLint plugin for writing SQL queries in a type-safe way.<br><br><video src="...">

Describe alternatives you've considered

If that's not an option, then having another configuration option like image2 would be an alternative.

Another alternative that I considered (but could not figure out) would be to somehow be able to extend ONLY this single section of that particular template, similar to what is being talked about here:

Additional context

No response

Validations

@kiaking
Copy link
Member

kiaking commented Sep 15, 2022

I like the idea of adding video feature, but unless we change the design I think user should choose either image or video, not both, for the Hero component. I don't think I can come up with a decent design where both logo and video fit nicely together (not enough space).

For the same reason, I'm not thinking of adding "image2" as well, because the design is not made for having 2 images.

So something like Nuxt Content site has is cool I think.
https://content.nuxtjs.org

For more complex usage, such as having 2 images, should be done in customization as you mentioned. Because you need define how they're aligned, spaced, gaps, and such and it's way complicated to handle in config option 😅

But again, let's add Video feature!

I was thinking to support famous video platform like YouTube and Vimeo to embed it. But do you think <video> tag is required? Or embedding external video service URL is enough 👀

@kiaking kiaking added enhancement New feature or request theme Related to the theme labels Sep 15, 2022
@brc-dd
Copy link
Member

brc-dd commented Sep 15, 2022

We can just provide a slot (#1062) with default content being the image. Users can then customize it to add video, etc.?

@kiaking
Copy link
Member

kiaking commented Sep 15, 2022

Yes! For the customized image, I think that works. Video embedding I meant was, it would be cool if we can do this in frontmatter.

---
layout: home
video: https://youtube-url.com/...
---

And then the default theme will handle it and create beautiful looking component. Like it has Thumbnail and play button, and when user clicks it, it opens modal and make video decent amount of size and such 👀

But as you mentioned I think we can start from #1062 and I think it should cover many usecases 👍

@karlhorky
Copy link
Author

Thanks for the feedback! I will watch #1062 :)

But do you think <video> tag is required? Or embedding external video service URL is enough 👀

It would be nice to have the flexibility of a <video> tag if possible. Although I do think that some users would embed an external video as well.

@karlhorky
Copy link
Author

karlhorky commented Dec 28, 2022

Now that @g4rry420's #1528 PR has been merged and #1062 has been closed, does this offer a way to also include a <video> tag in this slot?

I'm still pretty new to VitePress - would it be possible to get an example of how to do this?

Thanks to @g4rry420 and @brc-dd for the PR and merge!

@brc-dd
Copy link
Member

brc-dd commented Mar 10, 2023

Refer this: https://vitepress.dev/guide/extending-default-theme#layout-slots

<script setup>
import DefaultTheme from 'vitepress/theme'
</script>

<template>
  <DefaultTheme.Layout>
    <template #home-hero-image>
      Put your video here ...
    </template>
  </DefaultTheme.Layout>
</template>

@karlhorky
Copy link
Author

@brc-dd thanks! I've implemented over here:

This is part of this PR:

@karlhorky
Copy link
Author

karlhorky commented Mar 10, 2023

Oh, the deploy preview for that does not show the video, did I do something wrong?

Screenshot 2023-03-10 at 10 48 57

I thought it would take place of the image on the right. Or maybe VitePress 1.0.0-alpha.13 is too old and needs to be updated? 🤔

Here's my fork / branch: https://github.com/karlhorky/safeql/tree/add-video-to-homepage

@brc-dd
Copy link
Member

brc-dd commented Mar 10, 2023

I think you forgot to bump vitepress' version there?

@karlhorky
Copy link
Author

Looks like it's working, thanks!!

Kapture.2023-03-10.at.11.13.22.mp4

Closing this issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request theme Related to the theme
Projects
None yet
Development

No branches or pull requests

3 participants