Skip to main content

Embedding Videos

Embeding videos on your webbsite enhances the user experience – in our visual-driven culture, people prefer viewing to reading. This increases time on site, higher click-through-rates, boosted conversions, and, thus, revenue, are among the clear benefits of embedding videos on your website

To embed a video on your website,

  1. Select Embed Video option from the drop down.

Docusaurus

  1. Type or copy-paste the url for the video into the textbox below.

That's it!!

Displaying the embedded video#

Displaying the embedded video is very simple.

In your twig file, add

// entries.asset is the Craft CMS field name{{ entries.asset.render() }}

Rendering options#

The render() function accepts parameters which will be passed directly to the rendered output tag.

So for instance, the below code

// entries.asset is the Craft CMS field name{{ entries.asset.render({'class':'row-flex col-sm-3','hello':'world'}) }}

will result in

<iframe src=... class='row-flex col-sm-3' hello='world'></iframe>

Having said that, there is an exception.

Setting the height and width of the output elements inline is not a commonly preferred approach. But if you have no choice, you can pass the width and height parameters along with an extra attribute called size, value of which should be set to true.

// entries.asset is the Craft CMS field name{{ entries.asset.render({'size':true,'width':'100px','height':'100px'}) }}

will result in

<iframe src=... style='width:100px;height:100px;'/>

Available Twig Method#

type() - Returns string 'aicon'.

// entries.asset is the Craft CMS field name{{ entries.asset.type() }}