Enabling caching features
- Keep the XML Sitemap up to date with your website’s content.
- Only include indexable pages.
- Don’t list more than 50,000 URLs in a single XML Sitemap.
- Make sure the sitemap’s (uncompressed) file size doesn’t exceed 50MB.
- Reference the XML sitemap in the robots.txt file.
- Stores > Configuration (under Settings) > Catalog > XML Sitemap.
- By default, the options for categories, products and CMS pages are configured correctly. Google doesn’t use the Frequency and Priority hints, so there’s no need to change anything there. By default, images are included in the XML Sitemap as well.
- At the top of the page, select Default Config for Store View to manage the generation settings for the XML sitemap. The page will reload, and when you scroll down a little, you’ll see that you can define if, when, and how often the XML sitemap needs to be regenerated under Generation Settings.
- By default, the Enabled field is set to No. Change this to Yes, because you want your XML sitemap to be regenerated automatically.
- Keep the value of the Frequency field set to Daily to make sure the XML sitemap is regenerated every day. This too is just an example: if the content on your store only changes once a week, it makes more sense to regenerate the XML sitemap once a week.
- XML sitemap: limits and robots.txt
- Things get interesting down below; under Sitemap File Limits, you’ll find the fields Maximum No of URLs Per File and Maximum File Size.
- For most Magento stores, the default Maximum No of URLs Per File limit is correct as it aligns with SEO best practices.
- You can raise the maximum file size to 52428800, as this equals 50 MB.
- Once this is all set up, it’s time to create the XML sitemap and configure its (re)generation settings. To do this, go to Marketing > Site Map (under SEO & Search) and click the orange Add Sitemap button.
To enable the built-in caching features in Magento:: :
Magento 2 comes with XML sitemap functionality. To configure the XML sitemap, log on to your Magento backend and navigate to: :
Including categories, products, and CMS pages in XML sitemap :
XML sitemap generation Settings
XML sitemap: Maximum No of URLs Per File
XML sitemap: Maximum File Size
XML sitemap: Enable Submission to Robots.txt
In the screen that follows, you define the XML sitemap’s name and location: :
STEP 1:
Fill in the XML Sitemap’s name in the field Filename, example: sitemap.xml.
STEP 2:
Then fill in the XML sitemap’s path in the Path field – for example /pub/ in our case because of the nature of the Magento installation in our test setup.
STEP 3:
Next, click the Save & Generate button, and you’re all done!