fbpx

Noindexing Auto-Generated Default Pages

No Index Auto-Generated Default Pages

Auto-generated default pages, such as cart, checkout, and account pages, can dilute your SEO efforts. To prevent search engines from indexing these pages, you can use the noindex meta tag.

Shopify

In Shopify, you can add the noindex tag by editing the theme’s theme.liquid file. Follow these steps:

  1. Go to Online Store > Themes > Actions > Edit Code.
  2. Open the theme.liquid file.
  3. Add the following code within the section:

  {% if template contains 'cart' or template contains 'checkout' or template contains 'account' %}
  {% endif %}

To noindex specific Shopify pages such as /collections (all collections), /collections/all (all products), and /collections/new (new products), you will need to modify the collection.liquid template file and potentially add conditional logic to handle these specific URLs.

Here’s how you can do it:

1. Access Your Theme Code

  1. Login to Shopify Admin: Go to your Shopify admin dashboard.
  2. Navigate to Themes:
    • From the admin dashboard, go to Online Store > Themes.
  3. Edit Code:
    • Find the theme you are currently using.
    • Click on Actions > Edit code.

2. Edit the collection.liquid Template

  1. Locate the collection.liquid file:
    • In the Templates folder, find and open collection.liquid.
  2. Add Conditional Noindex Meta Tags:
    • Insert the following code within the <head> section of the collection.liquid file. This code will add a noindex meta tag for the specified collection pages.
      <!DOCTYPE html>
      <html lang="en">
      <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        {% if collection.handle == 'all' or collection.handle == 'new' %}
          <meta name="robots" content="noindex">
        {% endif %}
        <title>{{ collection.title }}</title>
        ...
      </head>
      <body>
        ...
      </body>
      </html>
      

    This code snippet uses Liquid conditions to check if the collection handle matches 'all' or 'new'. If it does, it inserts a noindex meta tag.

3. Handle the /collections Page Separately

The /collections page lists all collections and may require a different approach. Typically, this is managed by the list-collections.liquid file.

  1. Locate the list-collections.liquid file:
    • In the Templates folder, find and open list-collections.liquid.
  2. Add Noindex Meta Tag:
    • Insert the noindex meta tag within the <head> section:
      <!DOCTYPE html>
      <html lang="en">
      <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="robots" content="noindex">
        <title>All Collections</title>
        ...
      </head>
      <body>
        ...
      </body>
      </html>
      

4. Save and Publish

  • After adding the noindex tags to the relevant template files, save your changes.
  • Publish the updated theme if necessary.

5. Verify the Changes

  • Visit the pages you have noindexed and check the page source to ensure the meta tag is correctly included in the <head> section.
  • Use tools like Google Search Console to confirm that these pages are not being indexed by search engines.

Summary of Code Changes

collection.liquid:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  {% if collection.handle == 'all' or collection.handle == 'new' %}
    <meta name="robots" content="noindex">
  {% endif %}
  <title>{{ collection.title }}</title>
  ...
</head>
<body>
  ...
</body>
</html>

list-collections.liquid:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="robots" content="noindex">
  <title>All Collections</title>
  ...
</head>
<body>
  ...
</body>
</html>

By following these steps, you will ensure that the /collections/collections/all, and /collections/new pages are noindexed, preventing search engines from indexing these pages.

WooCommerce (WordPress)

In WooCommerce, you can use a plugin like Yoast SEO to add the noindex tag. Follow these steps:

  1. Install and activate the Yoast SEO plugin.
  2. Go to SEO > Search Appearance > Content Types.
  3. Find the sections for Products, Product Categories, and Product Tags.
  4. Set the Show Products in search results? option to No for each section you want to noindex.

Alternatively, you can add custom code to your theme’s functions.php file:

function noindex_woocommerce_pages() {
  if (is_cart() || is_checkout() || is_account_page()) {
    echo '';
  }
}
add_action('wp_head', 'noindex_woocommerce_pages');