Magento 2 and SEO — tips and tricks
If you are migrating an existing website to the Magento 2 platform or developing a completely new website and want to ensure a proper technical SEO setup, there are some details to take into consideration when dealing with Magento 2 SEO default settings.
The scope of Magento 2 SEO default settings
In Scandiweb, when migrating websites or developing new ones from scratch, we offer an SEO technical setup. Even if an e-commerce store is not heavily relying on search engines as an important traffic source, we don't want some technical issues to hold a website back from appearing in Google. Therefore, we have developed an SEO checklist to follow when working on migration projects. Magento 2 default SEO settings support some nice features, however, quite a lot are missing from our list.
Here are some of the suggested setups for an e-commerce store (based on migration framework):
Based on the needs of a client, we might install a Scandiweb-developed Magento 2 SEO module or suggest to purchase a ready-made SEO extension available in the market.
Should you buy a Magento 2 SEO extension?
The first question you should ask yourself — are you planning to invest in SEO as a traffic source in the future? If you rely a lot on organic traffic and are planning to perform ongoing search engine optimization in-house or together with an SEO partner, then you might consider purchasing some enhanced Magento 2 SEO extension, which will cover all basic SEO settings and leave room for future optimization. There are different options available on the market. We have installed the Mageworx extension for a few projects and it seems to do its job well. As an alternative, you can check the Magento 2 SEO extension by Mageplaza.
You can also proceed with Magento 2 SEO settings. Below you can find what exactly can be done in Magento 2 to improve the technical SEO setup and what to take into consideration to avoid pitfalls.
Magento 2 SEO settings you should know about
1. URL suffixes
It is said that the ending of your URLs won't affect rankings in search engines. URLs can end with a slash or without a slash, as well as have .php or .html suffixes — it will neither provide you with any additional benefit nor harm your rankings. By default, Magento 2 products and category page URLs have the .html suffix.
However, if you don't perform website migration with a goal to keep URLs exactly the same as they were before (including .html suffix at the end), we would suggest getting rid of this default setting. Leave URLs as clean as possible.
You can remove the suffix in the Magento Backend -Stores/Configuration/Catalog/Catalog/Search Engine Optimization
URL suffix settings
Leave the fields blank, save updated configurations, run reindex and clean the cache. Done! You should have nice and clean URLs now.
Note, there won't be automatic redirects enabled from old URLs to new ones, you should take care of that additionally. Also, if your store has some custom built stuff, such changes should definitely be tested before applying to the Live environment to avoid breaking some existing functionality of the website.
2. Limitations of CMS pages
Magento 2 is an e-commerce platform. In the settings, there is a big focus on Product and Category pages. Therefore, CMS pages are sometimes neglected. For example, we have seen many times when crawling a Magento 2 website that CMS pages have 2 versions of URL available — with and without trailing slash at the end. Both are linked internally and no redirects are in place. So, if it's planned to create SEO friendly CMS pages, then you would need developer help to get rid of duplicate content by removing one version of URL and setting redirects. Also, you would need the help of developers to add canonical tags to CMS pages. There are no out of box settings for that.
Magento 2 has a nice option to adjust robots.txt right in the backend (there might be adjustments needed on the server side to make it work, though).
The field is blank by default, but after clicking the Reset to Default button, you can enable default Magento 2 robots.txt file.
Magento 2 Robots.txt settings and the default file
You can use the default version of robots.txt, however, it's not the best possible solution. For example, the line Disallow: /? *blocks all URLs with a question mark from being indexed. In case of Magento 2, the question mark in URLs appears in category pages with filters or sorting applied www.example.com/gear/bags?style_bags=2 as well as paginated pages www.example.com/gear/bags?p=2. Such pages are linked internally and might be linked somewhere in the web and in such cases, Google will index them even if they appear in the robots.txt file. So it's better to remove such a line, otherwise, you might get:
If you enable canonical tags, then category pages with parameters will point to clean category URL and Google actually won’t index faceted navigation and pass the SEO value to the clean URL.
In Scandiweb, we adjust robots.txt based on the needs of the website. This is the general template we currently use:
Adjusted robots.txt file
In each robots.txt, there should be an XML sitemap URL included. You can either copy the absolute URL to the XML sitemap manually or enable XML sitemap submission to robots.txt in the backend — Stores/Configuration/Catalog/XML sitemap.
Enable submission to robots.txt in M2 Backend
Default meta robots
Make sure that Default Robots are set to INDEX, FOLLOW if you want the website to be indexed. This functionality is quite handy before the website go-live as it's quite a convenient way how to keep the pre-live website version out of the index.
4. Canonicals tags
It’s possible to enable canonical tags for products and categories. Stores/Configuration/Catalog/Catalog/Search Engine Optimization.
Settings of canonical tags
The settings work good and it solves a lot of possible issues with duplicate content. Note, for the homepage and CMS pages there is no such option to enable canonicals in the backend, so adjustments in the code will be needed.
5. Edit meta titles and meta descriptions
You can adjust meta titles and descriptions individually one by one from a specific product page or category page. Additionally, you can adjust the URL key and Meta keywords (Google doesn't pay attention to them anymore so you can leave this field empty).
Obviously, for a big e-commerce store, it's nearly impossible to create unique meta titles and descriptions for each product. So it's still suggested to opt for an extension which would help to create templates to automatically add meta descriptions.
A nice feature is an opportunity to edit Title Suffix to ensure that there is Brand visibility ensured.
Content /Design/Configuration/Choose Store view/HTML Head
XML Sitemap settings can be configured in Stores/Configuration/Catalog/XML Sitemap.
Default settings are ok. Just make sure you enable automatic generation of the XML sitemap as, by default, it's disabled and might become outdated in a while.
Enabling automatic generation of the XML sitemap
Unfortunately, Magento 2 default functionality doesn’t allow to exclude or include specific URLs.
After XML sitemap generation using default Magento 2 settings, I am usually crawling the sitemap and comparing it with the whole website crawl using the vlookup function in Excel. It's a great way to identify important pages which are missing in the sitemap and also catch some random pages (e.g., migrated outdated CMS pages, stylesheet, test pages) which should be excluded from the sitemap.
Another lacking SEO feature in Magento 2 is an opportunity to split the sitemap into several separate ones based on page types (categories, products, CMS). Smaller sitemaps can help larger websites increase the number of indexed pages.
Structured data and Magneto 2 SEO
A nice addition in Magento 2 is that product pages have Schema.org enabled by default.
Google search results with Rich Snippets
So, the minimum is covered by default — name, SKU, ratings, price, the currency might be highlighted in Google. However, the Schema.org vocabulary has much wider opportunities. For example, organization related markup is missing and you can't capitalize on Knowledge Graph possibilities.
Magento 2 SEO Summary
There are some very nice features offered by Magento 2, but you can’t rely on Magento default settings if you’re looking for an opportunity to boost your SEO.