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 hero videos (YouTube/Vimeo) to single.html layout #781

Closed
wants to merge 8 commits into from

Conversation

justintoo
Copy link
Contributor

No description provided.

Copy link
Owner

@mmistakes mmistakes left a 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 not master.
  • 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 %}"
Copy link
Owner

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>
Copy link
Owner

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>
Copy link
Owner

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.

@mmistakes mmistakes changed the title Add page hero video for vimeo/youtube using embedresponsively.com code Add hero videos (YouTube/Vimeo) to single.html layout Jan 20, 2017
@justintoo
Copy link
Contributor Author

Cool, thanks for taking the time to educate me :-) Will push updates this weekend - happy Friday!

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

Successfully merging this pull request may close these issues.

5 participants