Skip to main content

Embedding Forms

After all, a contact form is one of the most important elements you can offer on your business website.

It keeps visitors from experiencing the frustration of not being able to expediently reach out when they have a problem or a question. What’s more, your contact form is often the origin of your relationships not only with your prospects—a group your email signup is typically limited to—but with every visitor type your website has.

To embed a form on your website,

  1. Select Embed Website option from the drop down.

Docusaurus

  1. Type or copy-paste the url for the website or third-party marketing form into the textbox below.

Displaying the embedded website or form#

Displaying the embedded website or form 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() }}