Skip to main content

How do I add a "noindex" meta tag to individual pages of my shop? - Knowledgebase / Search Engine Optimization (SEO) - ShopFactory Help Center

How do I add a "noindex" meta tag to individual pages of my shop?

Authors list

Question

I want to keep a few specific pages out of the Google search results, for example a landing page used in an email campaign, a thank-you page or a temporary offer page. How do I add <meta name="robots" content="noindex"> to the <head> section of those individual pages?

Answer

ShopFactory does not have a per-page field for adding code to the <head> section. The "Enter details for search engines" window of a page lets you set the page title, description, search words and file name, but it does not have an option for a robots tag.

There are two ways to achieve the same result. Option 1 is the recommended method. Option 2 is the alternative if you do not have access to your web server.


Option 1 (recommended): Add an X-Robots-Tag rule on your web server

Instead of a meta tag in the page, your web server sends a noindex instruction in the HTTP response header. Search engines treat this exactly the same as the meta tag. This is the most reliable method: it does not depend on JavaScript, it is picked up by all major search engines, and it is not affected when you republish your shop.

This method requires an Apache web server on which you can edit the .htaccess file. Most standard Linux hosting accounts allow this. If you are unsure, please ask your hosting provider.

Steps

  1. Publish your shop as usual, so the pages exist on the server.

  2. Note the file names of the pages you want to exclude (see "How do I find the file name of a page?" below).

  3. Connect to your website with an FTP program.

  4. Open the .htaccess file in the root folder of your website, or create it if it does not exist.

  5. Add the following lines, replacing the example file names with your own:

    SetEnvIf Request_URI "/(d12_offer|d34_thankyou)\.html$" NOINDEXPAGE
    Header set X-Robots-Tag "noindex, follow" env=NOINDEXPAGE

  6. Save the file and upload it back to the server.

Adding more pages

The page names are listed between the round brackets, separated by a vertical bar. Note that the .html extension is added once at the end and is not repeated for each page:

SetEnvIf Request_URI "/(d12_offer|d34_thankyou|d47_promotion)\.html$" NOINDEXPAGE

Notes

  • The Header directive requires the Apache module mod_headers. This is enabled on nearly all hosting accounts. If your website returns an error after adding the lines, remove them and contact your hosting provider.

  • If your website runs on a Windows/IIS server or on nginx, the same result can be achieved, but the configuration is different. Please ask your hosting provider how to set a X-Robots-Tag: noindex response header for specific files.

  • ShopFactory does not overwrite the .htaccess file when you publish, so the rule remains in place.


Option 2: Add the tag through ShopFactory Central

If you cannot edit files on your web server, you can add a small piece of code in ShopFactory itself. The code is added once and applies only to the pages that you list in it.

Steps

  1. Open your shop in ShopFactory.

  2. In the tree menu on the left, click on the ShopFactory Central page.

  3. Click the Search Engine Optimization (SEO) button.

  4. In the window that opens, click Website Analytics.

  5. Paste the code below into the Google Analytics code field. This field is not limited to Google Analytics. Any code placed here is added to the <head> section of every page of your shop. If the field already contains code, add the new code after the existing code. Do not paste it inside the existing code block.

  6. Click Close, then click Save.

  7. Enable Rebuild All in the Settings menu and publish your shop.

The code

<script>
(function () {
var pages = ["d12_offer.html", "d34_thankyou.html"];
var f = location.pathname.split("/").pop();
if (pages.indexOf(f) > -1) {
document.write('<meta name="robots" content="noindex,follow">');
}
})();
</script>

Only the pages listed between the square brackets receive the noindex tag. All other pages of your shop are not affected.

Adding more pages

Add each page file name between quotation marks and separate the entries with a comma:

var pages = ["d12_offer.html", "d34_thankyou.html", "d47_promotion.html"];

Notes

  • The tag is inserted while the page is being loaded. It is therefore not visible in "View source" in your browser, only in the loaded page. See "How do I check that it works?" below.

  • Google reads and follows the tag, but it has to render the page first, which can take slightly longer than with Option 1. Smaller search engines that do not process JavaScript may ignore it.


How do I find the file name of a page?

Both options use the file name of the published page. That is the last part of the page address.

For example, if the page address is:

https://www.yourshop.com/contents/en-us/d12_offer.html

then the file name is:

d12_offer.html

The easiest way to find it is to open the page on your live website and copy everything after the last forward slash in the address bar of your browser.

Please note:

  • Use the published file name. If you changed the file name in the "Enter details for search engines" window, for example from d12.html to d12_summer-offer.html, use the new name.

  • Copy the name exactly as it appears, including upper and lower case.

  • If the same page exists in several shop languages, the file name is normally identical in each language folder, so one entry covers all language versions of that page.

  • The home page of your shop cannot be excluded this way, as it does not have a file name in the address. If you need to exclude your home page, please contact support.


How do I check that it works?

Open the page in your browser, press F12 to open the developer tools, select the Elements or Inspector tab and look inside the <head> section. You should see:

<meta name="robots" content="noindex,follow">

For Option 1, the tag is not in the page at all. Instead, open the Network tab, reload the page, click the page entry and check the response headers for x-robots-tag: noindex, follow.

You can also use the URL Inspection tool in Google Search Console, which reports both the meta tag and the response header.


Two important points

  1. Do not also block these pages in your robots.txt file. A page that is blocked in robots.txt is never read by the search engine, so the noindex instruction is never seen and the page can remain in the search results.

  2. Leave the pages in your sitemap. ShopFactory keeps them in sitemap.xml, which is correct. It helps search engines to revisit the pages and pick up the change more quickly.

Removing a page from the search results is not immediate. Google has to crawl the page again before the change takes effect, which can take from a few days to several weeks.