Magento 2 Google Site Map Exclusion

Installation and User Guide for Magento 2 Google Sitemap Exclusion

Table of Contents

  1. Installation
    • Installation via app/code
    • Installation via Composer
  2. Configuration Settings for SEO Base
    • General Settings
  3. Configuration Settings for SEO Sitemap Exclusion
    • General Settings
    • Exclude Categories from Sitemap
    • Exclude Products from Sitemap
    • Exclude CMS Pages from Sitemap
    • How to Generate Sitemap
    • Add new Sitemap
    • Magento Out of the Box Functionality to set the Category Path
  4. Google Sitemap XML
    • Product Link in Sitemap XML
    • Category Link in Sitemap XML
    • CMS Pages Link in Sitemap XML
  5. Set Path Priority
  6. Override Canonical URL
    • Category Page
    • Product Page
    • CMS Page
  7. Set Primary Categories

Installation

https://docs.scommerce-mage.com/magento-2-extensions/installation-via-composer/installation-via-composer

Configuration Settings for SEO Base

Go to Admin > Stores > Configuration > Scommerce Configuration > SEO Base

General Settings

image.png

Configuration Settings for SEO Sitemap Exclusion

Go to Admin > Stores > Configuration > Scommerce Configuration > SEO Sitemap

General Settings

image (1).png

image.jpg

image (1).jpg

image (2).png

image (3).png

image (4).png

image (2).jpg

Set Path Priority

We have a priority system in place for the URL path that is to be included in the sitemap. The URL path is picked based on the below priority system:-

image (5).png

image (6).png

image (7).png

Override Canonical URL

You can set the override canonical URL for any product, category or CMS page. The steps to setup override canonical URL is provided as below:-

Category Page

Go to Admin>Catalog>Categories and select any category. Scroll down to find the tab "Search Engine Optimization". Enter the URL path in the "Override Canonical URL" section.

image (8).png

Product Page

Go to Admin>Catalog>products and select any product and click edit. Scroll down to find the tab "Search Engine Optimization". Enter the URL path in the "Override Canonical URL" section.

image (9).png

CMS Page

Go to Admin>Content>Pages and select any page. Scroll down to find the tab "Search Engine Optimization". Enter the URL path in the "Override Canonical URL" section.

image (10).png

Set Primary Categories

You can use a script provided with the extension to automatically add primary categories for products. Admin can exclude certain categories from primary category and also prioritise one category over the other to be picked as the primary category.

Go to Admin>Catalog>Categories select a category then scroll down to find the option "Primary Category Settings". Here click on "Exclude From Primary Category" to exclude this category from primary category or enter the priority 0 being the highes. The highest priority category will be picked first for the primary category.

image (11).png

To automatically assign primary category for all products run the command given below by going into the root directory of your store. 

scommerce:seo-base:set-primary-category

N.B - If you are using older version then run the script provided in the extension folder at the path Data/SetPrimaryCategoryM2.php from ssh

Google Sitemap XML

Google site map shows all the included Products, Categories, and CMS Pages links in the sitemap.xml.

image (12).png

image (13).png

image-08847.png

If you have a question related to this extension please check out our FAQ section first. If you can't find the answer you are looking for then please contact core@scommerce-mage.com.


Revision #5
Created 2 May 2025 12:50:20 by scommerce
Updated 24 October 2025 09:34:39 by scommerce