Skip to main content

Embedding Social Content

Interactivity and engagement are the two most important things social media is known for. It can help your website amplify your website’s interaction and engagement capabilities with its dynamic nature.

If people come across your social feed on your website, you can redirect them to your social media accounts for more followers. Coming to social media accounts, you can mention your website link on them that can help increase traffic to your website. You can easily channelize traffic and have a win-win situation from both the ends.

To embed social media content on your website,

  1. Select Embed Social option from the drop down.

Docusaurus

  1. Type or copy-paste the url for the social content into the textbox below. We support twitter, flickr, etc ADD MORE

That's it!!

Displaying the embedded social media content#

Displaying the embedded social meida content 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 'social'.

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