Dynamic route params not accesible in sitemap file of Next JS app router
I have a Next JS application which was built using Next 12 and I am migrating it to Next 14. I have multiple sitemaps indexed in google earlier. Now I am trying to migrate them to App router logic. In my project I have a sitemap with folder path as pages/sitemaps/[categoryId]/category.xml.tsx
which was accessible in the path https://localhost:3000/sitemaps/124/category.xml
. I want to maintain the path of the sitemap in my app router as well. I created file app/sitemaps/[categoryId]/category/sitemap.ts
to keep the exact same path.
Here is my code: