Skip to content

Commit 17ab35b

Browse files
committed
fix: Better docs for sitemap indexes
1 parent 7588b21 commit 17ab35b

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,17 @@ For each localization of a page the `<url>` in the sitemap XML will get an extra
123123

124124
This implementation is based on [Google's guidelines](https://developers.google.com/search/docs/advanced/crawling/localized-versions) on localized sitemaps.
125125

126+
## 🔗 Sitemap index
127+
128+
Large sitemaps (larger then 45.000 urls) will automatically be split up in to seperate sitemaps. <br />
129+
A sitemap index will be created that links to all the different sitemap chunks. <br />
130+
That sitemap index will be accessible on the default `/api/sitemap/index.xml` location.
131+
132+
It is required to set the `url` in the `./config/server.js` file in your Strapi installation.
133+
That will be used to create the links to the different chunks.
134+
135+
You can alter the 45.000 magic number through plugin config.
136+
126137
## 🤖 Robots.txt
127138

128139
To make sure search engines are able to find the sitemap XML create a `robots.txt` file in the front-end of your website and add the following line:

server/services/core.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Sitemap service.
55
*/
66

7-
const { getAbsoluteServerUrl } = require('@strapi/utils');
7+
const { getConfigUrls } = require('@strapi/utils');
88
const { SitemapStream, streamToPromise, SitemapAndIndexStream } = require('sitemap');
99
const { isEmpty } = require('lodash');
1010

@@ -206,7 +206,7 @@ const getSitemapStream = async (urlCount) => {
206206
const config = await getService('settings').getConfig();
207207
const LIMIT = strapi.config.get('plugin.sitemap.limit');
208208
const enableXsl = strapi.config.get('plugin.sitemap.xsl');
209-
const serverUrl = getAbsoluteServerUrl(strapi.config, true);
209+
const { serverUrl } = getConfigUrls(strapi.config);
210210

211211
const xslObj = {};
212212

0 commit comments

Comments
 (0)