Magento 2 Guide: Creating and uploading an XML sitemap

Magento 2 Guide: Creating and uploading an XML sitemap

Posted On: Nov 05, 2018 By Tim

93% of web experiences start with a search engine, so it is essential to make sure that search engines can find your website. With Google being the biggest player in the search market with 80% - 90% of the market share, it’s especially important that they know you exist.

But how do they find you, know your website even exists?

If you’ve just launched a brand new eCommerce website, unless you've told anyone, how do are search engines (and also people) going to know it exists.

They need to know you exist, but how do we accomplish this?

The simplest way to do this is by telling them with an XML sitemap.


What is an XML sitemap?

An XML sitemap is a list of all the important pages on a website. These are created to allow search engines to know of all the pages on a website, that helps them to better understand its structure. It also tells them when a page was last updated, letting search engines know if they need to recheck a page to see what has changed.

magento-2-xml-sitemap-example

What you need this for is so that search engines know your website exists, and we’ve already mentioned that Google has the most use of all of them (so you’ll want to make sure they know your website exists). So you need to create your XML sitemap and upload it to Google.

This can be done by creating a Google search console account for the website and uploading the XML sitemap to it (this can also be done for Bing).

How to create and upload an XML sitemap in Magento 2

Overview

  1. Marketing > SEO & Search > Site Map
  2. Add Sitemap
  3. Name the file (sitemap.xml)
  4. Set the path (/)
  5. Save & Generate
  6. Log into Google search console
  7. Crawl > Sitemaps
  8. Add/Test Sitemap
  9. Enter sitemap location (sitemap.xml)
  10. Submit

First, after we’ve logged into our Magento store, we go to Marketing > SEO & Search > Sitemap in the menu.

magento-2-marketing-sitemap

Here we’re presented with a page that will hold your sitemaps once created. Click the Create sitemap button to get started.

magento-2-add-simteap-button

Here, the setup is pretty straightforward. You need to create a filename, this name isn’t merely an identifier, but rather the file page and we’ve got to create the path to it, so if we’re creating an XML sitemap, we can call it sitemap.xml

Next, we need to say where in the file structure the information will be stored. Unless there’s somewhere specific you want to save it, simply put /, this will then save it from the base.

magento-2-creating-xml-sitemap-in-admin-area

Hit save and generate and wait for the sitemap to be created. Once it is, you can check it’s working properly by heading to the file location (in this case at: yoursite.com/sitemap.xml).

Now, you’ll need to upload it to your Google search console (if you don’t have an account it’s simple to set up).

Once you’re in the account, we’ll want to go to Crawl > Sitemaps.

google-search-console-crawl-sitemaps

In the top right of the page there will be a red “Add/Test Sitemap” button. Click this then add the path where your sitemap is located (in our case: sitemap.xml).

google-searchconsole-upload-sitemap

If you want to test to make sure it works, do that then repeat the steps above to submit, otherwise, hit the submit button. It will then prompt you to refresh the page, once you’ve done this, you will see that your sitemap has been submitted.

Pro Tip: To help things along, and get Google looking through your website, head to Crawl > Fetch as Google.

google-search-console-fetch-as-google

Here, you can request Google to check pages yourself. For us, we want Google to start checking the website, so hit the Fetch button (this will then check the homepage). The page will then load your home page. Hit the “request indexing” button next to it and you’ll get this pop-up.

google-search-console-request-website-indexing

Submit the Captcha and select to crawl this URL and its direct links. This will the instruct Google to check through all of the website :)

Changing the XML sitemap settings

For the more advanced/those who want more control over the XML sitemap in your Magento store, there are additional controls you have to increase the frequency they’re checked and the page priority. (For this, the examples will use a non-eCommerce website, but the steps are exactly the same).

To get to the options, head to Stores > Settings > Configuration.

stores configuration menu magento2 backend

Once here, we’ll want to navigate to Catalog > XML Sitemap.

magento-2-configuration-catalog-xml-sitemap

Here we’re presented with the options to change the options for:

  • Categories
  • Products
  • CMS pages
  • General settings
  • File limits
  • Add to robots.txt

Generally, if you’re unsure about changing these settings, it’s safe to leave them as default.

We are a experienced Magento Agency, working with brands both large and small. If you need any help with your Magento Store, get in touch with us today!

Ready To Talk

Choose a better website

Give us a call on 01952 897444. Alternitavely, drop us a message.

Drop us a message →