Using Connectors to Restrict Search Engine Indexing

Modified on Tue, 9 Dec at 11:54 AM

To prevent a page from being indexed by Google or other search engines, a script may be added using Connectors


This script can be added directly within an individual hub if you want to hide a page on a specific website, or it can be added through Connectors within Organization Groups if you’d like to apply it across all sites or a specific group of websites (see: Adding External Scripts with DA Connectors for details).


"noindex" JavaScript

<script> 
document.addEventListener("DOMContentLoaded", function () {
if (XXX) {
        var meta = document.createElement("meta");
        meta.name = "robots";
        meta.content = "noindex";
        document.head.appendChild(meta);
    }
});
</script>

An "if" statement must be added to the script to specify the page(s) you'd like to select.


Example: Selecting by page path

<script>
document.addEventListener("DOMContentLoaded", function () {
if (window.location.pathname === "/your-page-url") {
        var meta = document.createElement("meta");
        meta.name = "robots";
        meta.content = "noindex";
        document.head.appendChild(meta);
    }
});
</script>

Replace "/your-page-url" with the page’s path (eg. "/legal") to select all and apply the "noindex" to pages that would end in "/legal".


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article