Replies: 1 comment
-
Hello @hodge-jai, hope you doing well, //app/sitemap.ts
export const GetPost = async () => {
const data = await fetch("http://mywebsite.com/api/permalinks", {
method: "GET",
});
const res = await data.json();
return res;
};
export default function sitemap(): MetadataRoute.Sitemap {
// News Article
const posts = getPost()
const routesNews = posts.map((post) => ({
url: `${URL}/${post.slug}`,
lastModified: new Date().toISOString(),
}))
// Static pages
const routes = [
'',
'/another-static-routes'
].map((route) => ({
url: `${URL}${route}`,
lastModified: new Date().toISOString(),
}))
return [...routes, ...routesNews]
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there,
I'm trying to figure out how to generate sitemaps for a few hundred thousand urls using next-sitemap. Each url is of the form
https://mywebsite.com/<permalink>
where<permalink>
is a unique identifier. These pages are served dynamically using SSR. Essentially, I want next-sitemap to generate a set of sitemaps for these URLs, but I'm not entirely sure what's going on under the hood. I've followed some examples online, and this is my set up so farAt build time, it will generate the
sitemap.xml
index which contains two locations,https://mywebsite.com/sitemap-0.xml
which contains all URLs for my static pages, andhttps://mywebsite.com/permalink-sitemaps.xml
, which when accessed errors out. Ideally I'd like sitemaps generated for my permalinks to be of the formpermalink-sitemaps-0.xml
,permalink-sitemaps-1.xml
,permalink-sitemaps-2.xml
, etc. How would I go about doing this?Beta Was this translation helpful? Give feedback.
All reactions