How to publish a page in development mode without HubSpot content staging [code snippet]


How to publish a page in development mode without HubSpot content staging [code snippet]

HubSpot has a nice feature called content staging which prevents search engines form crawling and indexing the content. But if you are using HubSpot CMS starter you won’t have access to this tool. So a work around is to add the following code to the HEAD of your base layout HTML file. This adds the meta no-index tag and also adds an ugly alert to the bottom of the page to remind you the tag exists. As you work you can ignore the tag but when you are ready to publish you will remember to remove that tag so Google will be free to crawl and index your site.

<!-- Development Mode -->
<meta name="robots" content="noindex,nofollow,noarchive" />
<script>
window.addEventListener("load", function() {
const newDiv = document.createElement("div");
newDiv.textContent = "Development mode: noindex. When ready to publish, ask Jake Lett to remove this.";
newDiv.style.backgroundColor = "yellow";
newDiv.style.padding = "10px"; // Optional: add some padding for better visibility

// Get the body element
const body = document.body;

// Append the new div as the last child of the body, before the closing body tag
body.appendChild(newDiv);
});
</script>
<!-- End Development Mode -->

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