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

feat(styles): provide .youtube-responsive for 16:9 rendering #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

niklaas
Copy link
Contributor

@niklaas niklaas commented Aug 12, 2019

Attaching the class to a wrapper <div> ensures that the ratio of width
and height of the included <iframe> remains 16:9. This applies to all
viewing devices.

Example usage:

{{ youtube(id="aqz-KE-bpKQ", class="youtube-responsive") }}

Attaching the class to a wrapper `<div>` ensures that the ratio of width
and height of the included `<iframe>` remains 16:9. This applies to all
viewing devices.

Example usage:

```
{{ youtube(id="aqz-KE-bpKQ", class="youtube-responsive") }}
```
@Keats
Copy link
Collaborator

Keats commented Aug 12, 2019

Is that from the original theme?

@niklaas
Copy link
Contributor Author

niklaas commented Aug 13, 2019

It is. At their demo site you can see how hugo compiles its YouTube shortcode to HTML:

<div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;">
  <iframe src="//www.youtube-nocookie.com/embed/ZJthWmvUzzc" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;" allowfullscreen="" title="YouTube Video"></iframe>
</div>

This is a common pattern though.

I am not sure about the naming .youtube-responsive yet. But it's distinct (so easy to reference in the stylesheet) and explains what it is about.

Instead of providing the class, we could also think about extending/altering getzola/zola to compile the YouTube shortcode this way. I am happy to provide a PR for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants