Skip to content

External Video Url ​

Last updated View as Markdown

You get the embed URL of a YouTube or Vimeo video from a video_url setting.

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

Every parameter is added to the query string of the URL. Parameters are sorted by name.

For YouTube, these parameters are added unless you set them: controls=1, enablejsapi=1, modestbranding=1, origin (the store URL), playsinline=1 and rel=0. For Vimeo, only your parameters are added. true is written as 1 and false as 0.

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, mute: 1 }}

Output

text
https://www.youtube.com/embed/dQw4w9WgXcQ?autoplay=1&controls=1&enablejsapi=1&modestbranding=1&mute=1&origin=https%3A%2F%2Facme.youcan.store&playsinline=1&rel=0