I recently set up the sitemap for a Magento multistore built on Community Edition 1.9. Running into a few issues and confused by contradicting best practices, I wondered what sitemap generation is like in Magento 2.
Why do sitemaps matter?
Since all online stores compete for visibility and search engine optimisation, using a search engine friendly software can help a lot to reach your potential customers. Sitemaps are a way to help search engines crawl your page. So how is Magento 2 doing in the SEO area in general and in creating helpful sitemaps in particular?
These are the questions I answer in this post, plus some more general information on sitemaps in Magento 2.
- Does Magento 2 offer automatic generation of sitemaps?
- Can I change the sitemap’s name?
- What do sitemaps for multi stores look like?
- Does Magento 2 support weighting page types?
- How are multiple sitemaps integrated in the robots.txt file?
Thanks to Carmen’s talk about Magento 2 SEO features at Magento meetup Cologne I already knew that Magento 2 – in general – has the ability to create sitemaps, actually with a some new features compared to Magento 1. So I started to dig a bit deeper to find out if Magento 2’s SEO game is up to speed.
Does Magento 2 offer automatic generation of sitemaps?
Yes, it does. The sitemap can be generated via cron job, either daily, weekly or monthly at any point in time that you prefer. Go to Stores / Settings / Configuration / Catalog / XML Sitemap in your Magento backend and you can find the matching options under the tab Generation Settings. Please note that the automatic generation is only performed once you have created the sitemap initially by hand. To create a sitemap or two or three…, go to Marketing / SEO & Search / Site Map.
Can I change the sitemap’s name?
Magento 2 has finally adopted the American way of life with endless freedom and infinite possibilities to name your offspring and sitemaps. Name your sitemaps sitemap.xml, sitemap_de.xml, sitemap2.xml or whatever you like. The file can be stored in any existing directory. It is recommended to place sitemaps in the root directory. The reason is that if you abide by the rules of the sitemap protocol, then sitemaps can only contain URLs that are stored on the same level or below. So if your sitemap is placed in www.storeurl.com/media/sitemap.xml, it can only direct crawlers to pages whose URL starts with www.storeurl.com/media/.
What do sitemaps for multi stores look like?
You create sitemaps for each store view separately, so each sitemap looks like your average sitemap: there is no language information included, no references to URLs of translated pages in other store views. It would have been great to add at least the href language tag of each site to its URL inside the sitemap. If this is something that bothers you, find more information and recommendations in Google’s help pages. As of now, there seems to be no Magento 2 extension offering language cross-referencing sitemaps. If you have found one, I would really appreciate it if you left a comment below.
Does Magento 2 support weighting page types?
Yes, you are free to set the priority for any page type – categories, products and CMS pages – just like in Magento 1. To do so, go to Stores / Settings / Configuration / Catalog / XML Sitemap. Enter any value from 0.0 to 1.0, where 1.0 signals crawlers that these sites are most important. Note that priority is a relative value, comparing on URL of your own store with another one. You are not able to signal Google that your pages are more important than your competitors. Unfortunately, SEO is not that easy.
How are multiple sitemaps integrated in the robots.txt file?
If you enable Magento 2 to add sitemaps to the robots.txt file, they are listed individually. There is no sitemap index.
Other settings for sitemap.xml in Magento 2
In order to make sitemaps accessable, they should not be larger than 10 MB, with a maximum amount of 50,000 URLs (according to the Sitemap protocol). Magento 2 sets the maximum file size of any sitemap per default to exactly 10 MB (or 10485760 bytes) and also provides the option to limit the number of URLs, again, the default value is in accordance with the Sitemap protocol.
Under your XML sitemap’s product options, you are able to decide if images are to be added into the sitemap: either none, base images only or all. Depending on the number of products you have and the average number of images per product, it could be reasonable to only include the base images so as not to blow up your sitemap’s file size.
If the automatic sitemap generation fails, Magento 2 offers an email notification. Use the field “Error Email Recipient” under the sitemap’s general settings to enter the e-mail address of the one in charge.
Magento 2 comes with some great improvements regarding SEO and sitemaps. I especially like the new possibility to change the sitemap’s name. Also, the automatised inclusion of sitemaps in robots.txt helps any busy SEO manager so you won’t forget to include your sitemaps in the robots.txt. If only some of the sitemap settings were not hidden somewhere under “marketing”, but this is probably just unfamiliar, something to get used to. All in all, these SEO settings are a step forward regarding both functions and usability.
Sonja Riesterer is the Marketing Manager at integer_net. She especially enjoys organising events. As a Magento Certified Solution Specialist and Magento Master 2017 she also offers Magento admin trainings.