-
Notifications
You must be signed in to change notification settings - Fork 25.9k
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 hero videos (YouTube/Vimeo) to single.html layout #781
Conversation
- Fallback to default positioning for browser that don't support it IE, Chrome < 56, etc. - Issue mmistakes#752
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! Some feedback below. If you wouldn't mind fixing some of these things to comply with code style of the theme I can get this merged in.
- Submit pull request against the
develop
branch and notmaster
. - Fix indenting in (2 space vs. 4)
- Move inline CSS to Sass partial (
_sass/_utlities.scss
) - Replace apostrophes with double quotes ie:
<div class="embed-container">
instead of<div class='embed-container'>
{% capture video_id %}{{ page.header.video.id }}{% endcapture %} | ||
{% capture video_provider %}{{ page.header.video.provider }}{% endcapture %} | ||
|
||
<div class="page__hero{% if page.header.overlay_color or page.header.overlay_video_path %}--overlay{% endif %}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the purpose of this code? As a test I added the following YAML Front Matter to add a color overlay as the code seems to suggest is possible, and no video was embedded.
header:
video:
provider: "youtube"
id: "gOBj8HdfA2Y"
overlay_color: "#333"
Had to remove overlay_color
for it to work.
> | ||
|
||
{% if video_provider == "vimeo" %} | ||
<style>.embed-container { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 100%; } .embed-container iframe, .embed-container object, .embed-container embed { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }</style><div class='embed-container'><iframe src='http://player.vimeo.com/video/{{ video_id }}' frameborder='0' webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix indent (use 2 spaces), replace single quotes with double, and pull out <style>
for .embed-container
.
I'd prefer any styling be added to the theme's CSS instead of adding inline. Since it's exactly the same for Youtube and Vimeo this is a safe move.
You can add it to _sass/_utilities.scss
at the very end like so:
/*
Responsive Video Embed
========================================================================== */
.embed-container {
position: relative;
padding-bottom: 56.25%;
height: 0;
overflow: hidden;
max-width: 100%;
iframe,
object,
embed {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
}
> | ||
|
||
{% if video_provider == "vimeo" %} | ||
<style>.embed-container { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 100%; } .embed-container iframe, .embed-container object, .embed-container embed { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }</style><div class='embed-container'><iframe src='http://player.vimeo.com/video/{{ video_id }}' frameborder='0' webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is invalid Liquid for "else if". Should be {% elsif video_provider == "youtube" %}
instead.
Cool, thanks for taking the time to educate me :-) Will push updates this weekend - happy Friday! |
0cb1026
to
c55d436
Compare
No description provided.