Use is_in_editor to Add Inline Comments and Notes Only in the HubSpot Editor [code snippet]


Use is_in_editor to Add Inline Comments and Notes Only in the HubSpot Editor [code snippet]

As a HubSpot CMS developer, you sometimes need to add some contextual information in templates to make it easier for content editors to know where and how to edit things. Add the code below into a template to display help text only when editing the HubSpot template.

{% if is_in_editor %}  
<style>.hseditor-help {background:#FFFFE0;padding:1rem;text-align:center;}</style>
<div class="hseditor-help">
    <h4>Header - All Posts</h4>
    <p>Header - All Posts</p>
</div>
{% endif %}

Below is an example of how these editor notes will look.

is_in_editor in HubSpot CMS

Written by: Jake Lett
Jake Lett is a B2B marketing consultant with over 15 years of experience in the digital marketing industry. He specializes in SEO, HubSpot, and PPC campaign management. Jake has a proven track record of helping businesses increase their online visibility and drive more traffic, leads and sales. He is a Certified Google Ads Specialist and a Certified HubSpot Developer.

Related posts

Tags:

Want to Get Email Updates of New Articles?

Join My Email Newsletter