external_video_tag
Generates a player for a specified external video in an <iframe> tag. An external video is a video hosted on a platform external to SHOPLINE.
Only YouTube video URLs are supported.
{{#external_video_tag videoUrl attribute=any /}}
Required params
videoUrl string: The URL of the external video.
Optional params
attribute any: The attribute=any in the syntax represents a placeholder. You can pass any native HTML attributes (such as class="my-video", id="player", or style="..."), which are applied directly to the generated <iframe> tag.
Examples
Rendering a video player
Use this tag together with the external_video_url filter to render a YouTube video player.
{{#external_video_tag media | external_video_url() /}}
{{#for media in product.media}}
{{#switch media.media_type}}
{{#case "external_video" /}}
{{#if media.host == "youtube"}}
{{#external_video_tag media | external_video_url(autoplay=true, loop=false) /}}
{{/if}}
{{/switch}}
{{/for}}
Adding HTML attributes
Pass in standard HTML iframe attributes, such as class and frameborder.
{{#external_video_tag media | external_video_url() attribute=any /}}
{{#for media in product.media}}
{{#switch media.media_type}}
{{#case "external_video" /}}
{{#if media.host == "youtube"}}
{{#external_video_tag media | external_video_url(autoplay=true, loop=false) class="video-media-youtube" frameborder="0" /}}
{{/if}}
{{/switch}}
{{/for}}
Was this article helpful to you?