Skip to content

External Video Tag ​

Last updated View as Markdown

You get an <iframe> that embeds a YouTube or Vimeo video. Use it on a video_url setting, or after external_video_url to add parameters to the URL.

liquid
{{ video | external_video_url: parameter: value | external_video_tag: attribute: value }}

Every option is added as an attribute of the tag, for example class or loading. title is added after src. All values are escaped.

When the setting is empty or the URL is not a YouTube or Vimeo URL, you get an empty string.

Example ​

liquid
{{ section.settings.video | external_video_url: autoplay: true | external_video_tag: class: 'hero-video', title: 'Our story' }}

Output

html
<iframe frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen="allowfullscreen" class="hero-video" src="https://www.youtube.com/embed/dQw4w9WgXcQ?autoplay=1&amp;controls=1&amp;enablejsapi=1&amp;modestbranding=1&amp;origin=https%3A%2F%2Facme.youcan.store&amp;playsinline=1&amp;rel=0" title="Our story"></iframe>