#Nextjs 14 why my dynamic sitemap.xml not working?

4 messages · Page 1 of 1 (latest)

lost axle
#

According to nextjs docs I crate an sitemap.js file inside my app directory for crate an dynamic sitemap but when I go http://localhost:3000/sitemap.xml I see 404 not found

enter image description here

here my code

app
sitemap.js

  return [
    {
      url: 'https://acme.com',
      lastModified: new Date(),
      changeFrequency: 'yearly',
      priority: 1,
    },
    {
      url: 'https://acme.com/about',
      lastModified: new Date(),
      changeFrequency: 'monthly',
      priority: 0.8,
    },
    {
      url: 'https://acme.com/blog',
      lastModified: new Date(),
      changeFrequency: 'weekly',
      priority: 0.5,
    },
  ]
}```
but when I crate an sitemap.xml inside my app directory I can see only static content not getting any content from sitemap.js
old krakenBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

pure glacier
lost axle