Sitemap does not contain links to all pages
See original GitHub issueDescribe the bug My project has 5 pages. Generated sitemap has only 2.
To Reproduce
I am creating new sitemap using next-sitemap --config next-sitemap.config.js
Expected behavior I expected sitemap to contain links to all 5 pages.
Additional context next-sitemap.config.js:
module.exports = {
siteUrl: process.env.SITE_URL || 'https://apps.is',
generateRobotsTxt: true,
}
The generated sitemap:
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
<url><loc>https://apps.is</loc><changefreq>daily</changefreq><priority>0.7</priority><lastmod>2021-05-17T15:46:41.100Z</lastmod></url>
<url><loc>https://apps.is/our-way</loc><changefreq>daily</changefreq><priority>0.7</priority><lastmod>2021-05-17T15:46:41.100Z</lastmod></url>
</urlset>```
Issue Analytics
- State:
- Created 2 years ago
- Comments:5
Top Results From Across the Web
Sitemap tool fails to find all URLs in my site [closed]
The sitemap generator will start at the root and follow all links on the pages and so on until it has exhausted all...
Read more >Why my sitemap doesn't have any link pages after generated?
It seems that your website is dynamic website so websites like xmlsitemaps.com can not crawl it. you will have to ask you developer...
Read more >Why are some website pages not included or missing ... - Quora
Some website pages are not included or missing in a sitemap because they don't have any content or have a low amount of...
Read more >Sitemap has no links - WordPress.org
I just noticed the sitemap is almost blank. Even after changing a few settings like the caching of the sitemap, there still are...
Read more >Should XML sitemaps include *all* pages or just the deeper ...
The idea is that if your site does not provide crawlable navigation, Google can use your sitemap to crawl your site. There are...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks @abzeede and @sanderfish answer to solve this problem.
Let me try to explain more after tracing source code by myself.
If we run next-sitemap of script, it will run /bin/next-sitemap file and load cli.
So, we can see what happen at /src/cli.ts and focus on
when we read more detail about
getRuntimePaths
at /src/path/index.ts, we can realize it returnwe can get file paths about
build-manifest.json
,prerender-manifest.json
andexport-marker.json
that all files will be create afternext build
and will be used to create url set at /src/cli.ts.To conclude, cause next-sitemap need to use files will be create after
next build
to create sitemap, so we need to run next build before run the next-sitemap script.Hope to help understanding why need to do
not
Thanks.
Had the same issue. Chaining the build script instead of using
postbuild
works for me: