Generating sitemap
See original GitHub issueFeature request
My site contains several dynamic routes and uses the getStaticPaths
and getStaticProps
hooks from the 9.3 release. I’d like to generate a sitemap for it. It’s quite hard.
Describe the solution you’d like
I’d like some way of accessing the list of paths/pages generated during the build step. The information I need is printed to the CLI during “next build” but there’s no way (I think) for the developer to tap into it:
Describe alternatives you’ve considered
There are several other issues on here describing incomplete solutions that only work for static pages. My page has several dynamic routes ([blog.tsx]
). I’m not aware of any solution that works.
Additional context
Next.js is 🔥, this is the one thing tripping me up 🤙
Issue Analytics
- State:
- Created 3 years ago
- Reactions:21
- Comments:17 (14 by maintainers)
Top Results From Across the Web
XML Sitemaps Generator: Create your Google Sitemap Online
Free Online Google Sitemap Generator. XML-sitemaps.com provides free online sitemap generator service, creating an XML sitemap that can be submitted to ...
Read more >Build and Submit a Sitemap | Google Search Central
There are various tools that can generate a sitemap. However, the best way is to have your website software generate it for you....
Read more >Sitemaps: What They Are, How to Create One & Submit it to ...
How to Create a Sitemap · 1. Decide which pages on your site should be crawled by Google, and determine the canonical version...
Read more >Free Visual Sitemap Generator & XML Sitemap Creator
Use our FREE Sitemap Generator tool to crawl your website and generate visual site map with meta tags. Also generate sitemap XML for...
Read more >How to Create an SEO-Boosting XML Sitemap in 20 Minutes ...
Click on the Yoast Plugin ... It has a “Y” icon, and says “SEO.” It should be located in the left sidebar. ......
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
Solution based on information from the build manifest is not ideal, because pages with
getServerSideProps
,getInitialProps
andgetStaticProps
withfallback
option will not be supported. It is much better to create the sitemap on the fly (the approach was described in discussions multiple times) because only you know your web application better.Here is my boilerplate from
pages/sitemap.xml.jsx
:@marcofranssen In your
next.config.js
:More on rewrites: https://nextjs.org/docs/api-reference/next.config.js/rewrites