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 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

  3. Google Sitemap XML

    • Product Link in Sitemap XML

    • Category Link in Sitemap XML

    • CMS Pages Link in Sitemap XML

  4. Override Canonical URL

    • Category Page

    • Product Page

    • CMS Page

Installation

  • Installation via app/code: Upload the content of the module to your root folder. This will not overwrite the existing Magento folder or files, only the new contents will be added. After the successful upload of the package, run below commands on Magento 2 root directory.

php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
  • Installation via Composer: Please follow the guide provided in the below link to complete the installation via composer.

Installation Via Composer

Configuration Settings for SEO Base

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

General Settings

  • Enabled - Select “Yes” or “No” to enable or disable the module.

  • License Key – Please add the license for the extension which is provided in the order confirmation email. Please note license keys are site URL specific. If you require license keys for dev/staging sites then please email us at support@scommerce-mage.com.

Configuration Settings for SEO Sitemap Exclusion

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

General Settings

  • Enable - Select “Yes” or “No” to enable or disable the module.

  • Exclude Categories from Sitemap – To include or exclude categories, go to Admin > Catalog > Manage Categories > Select category (you want to exclude from site map) > General > Exclude from Sitemap: Set to “Yes/No”

  • Exclude Products from Sitemap – To exclude products from sitemap, go to Admin > Catalog > Manage Products > Select product (you want to exclude from sitemap) > General > Exclude from Sitemap: Set to ”Yes/No”.

  • Exclude CMS Pages from Sitemap – To exclude CMS pages from sitemap, go to Admin > CMS > Pages > Select CMS Page (you want to exclude from site map) > General > Exclude from Sitemap: Set to “Yes/No”

  • How to Generate Sitemap – To generate the site map from the admin panel go to, Admin > Marketing > Sitemap > Click ''Generate Sitemap''.

  • Add new Sitemap - You can create new site map from, Admin > Marketing > Sitemap > Click ''Add Sitemap'', it redirects to New Site Map page and by providing all the required details you can create Site Map.

  • Magento Out of the Box Functionality to set the Category Path - To include category path in product URLs in sitemap.xml, go to Admin > System > Configuration > Catalog > Catalog > Search Engine Optimizations > Use Categories Path for Product URLs: Set to "yes".

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:-

  • Override canonical URL:- It is of highest priority. If this is set for any product, category or CMS page then canonical URL path will be picked in the sitemap.

  • Set Primary Category:- It is secondest highest priority. If override canonical URL is not set then the primary category path set is picked in the sitemap.

  • Default Path:- if neither override canonical URL nor Set primary Category is set then the default path of the product, category or CMS page is picked to be included in the sitemap.

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.

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.

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.

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.

To automatically assingn 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.

  • Category Link in Sitemap XML - You can see the category link in the Google Sitemap XML.

  • CMS Pages Link in Sitemap XML - In the below screen grab you can see the about-us page link in the Google Sitemap XML.

  • Product Link in Sitemap XML - You can see the product link in the Google Sitemap XML.

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.

Last updated