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

Get a Free HubSpot CMS Guide
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

Related resources

  • HubSpot CMS vs WordPress: Feature Comparison and Review
  • 25+ Questions to Ask Before Redesigning Your Business Website
  • 5 Things A Business Should Consider Before a Website Redesign
  • How to Get a Responsive Website for Your Manufacturing Company
  • What Is a Good WordPress Alternative for Businesses?

  • Related posts

    Tags:

    Want to Get Email Updates of New Posts? Join My Email Newsletter