next-sitemap: [Probs a bug] Totally empty sitemap? Lol?
Hello.
I’m using Next.js 13 with the App Router. I know that next-sitemap can generate good sitemaps files with this setup. I’ve already done this in my current (and first Next.js) project.
I’m doing my best with generateStaticParams
, and have an exhaustive output of my paths when I build my Next project.
Output of yarn build
:
Route (app)
┌ ● /[locale]
├ ├ /fr
├ └ /en
├ ● /[locale]/[categ]
├ ├ /fr/patch-notes
├ └ /en/patch-notes
├ ● /[locale]/[categ]/[subcateg]
├ ├ /fr/patch-notes/dashboard
├ ├ /fr/patch-notes/discord-bot
├ ├ /en/patch-notes/dashboard
├ └ /en/patch-notes/discord-bot
├ ● /[locale]/[categ]/[subcateg]/[slug]
├ ├ /fr/patch-notes/dashboard/post-01
├ ├ /en/patch-notes/dashboard/post-01
├ ├ /fr/patch-notes/discord-bot/post-01
├ └ /en/patch-notes/discord-bot/post-01
├ ● /[locale]/dashboard
├ ├ /fr/dashboard
├ └ /en/dashboard
├ ○ /apple-icon.png
├ ○ /favicon.ico
└ ○ /icon.svg
● (SSG) automatically generated as static HTML + JSON (uses getStaticProps)
Here is sitemap.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
</sitemapindex>
(yah, I’m crying)
Moreover, here’s the disaster:
As I’m a bit of an idiot (lol), I tend to use the git commit --amend
command a lot and I totally lost the original code which was somehow “compatible” (?) with next-sitemap, and which was not generating empty sitemaps.
To be honest, I don’t have the courage, nor the knowledge, to understand what’s happening to take me from a correct sitemap generation to a totally empty one. ( 😢 )
I’ve made a branch to help you to reproduce and investigate. https://github.com/Tirraa/dashboard_rtm/tree/next-sitemap-empty-sitemap-issue
ℹ️ It would be also helpful to know how could I investigate myself? I naively assumed that if my routes were displayed correctly in the build output, it should be fine (lol).
Warm regards. ( I’m so sad to have an empty sitemap. 😢 )
About this issue
- Original URL
- State: open
- Created 10 months ago
- Reactions: 6
- Comments: 30
Empty sitemap here as well
For me it is just happening with the new
app
directory, I have 2 other projects with this same library and almost exactly the same configuration but they use the oldpages
directory and they work perfectlyUp this, I have the same issue as well
in my case it was related to this: https://github.com/iamvishnusankar/next-sitemap/issues/692
I had it working for some time without any issue. And today it decided to not work anymore as mentioned by everyone here. Trying to retrace what happened. My main changes have been to add trpc and clerk.
In case someone really stuck with it, I’ve migrate to the official, took me 20 minutes and its smooth.
I’m using Next 14 with the pages folder and I’m getting empty sitemaps too. No errors.
It depends on how you generate your static page, but on my side, I generate page based on data from my db, so I’m simply generating my sitemap based on the same data I use to generate static page. Just an example for the idea :
I’m doing something like that. So I have various array of from my static pages for different routes. once setup you don’t have to touch it anymore and what’s happening is very predictable which make the sitemap less mysterious and give you full control over it. and adding a single regular page just take 10 seconds which is find.
Yup, with one more:
I have pages of all kinds in my build (two server side and two static) - still doesn’t work.
Having the same issue, I thought it’s my issue (missing some config) until I see this. Will wait for the inputs here.