How to retrieve locale from sitemap?
Unanswered
Weevil parasitoid posted this in #help-forum
Weevil parasitoidOP
Hi guys,
Here is my sitemap.tsx :
Is there a way to get the locale from here?
Here is my sitemap.tsx :
export default function sitemap(): MetadataRoute.Sitemap {
const appUrl = process.env.APP_URL;
const locale = "fr";
const filteredPathnames: { [key: string]: string | Record<AvailableLocale, string> } = Object.fromEntries(
Object.entries(pathnames).filter(([_, value]) => typeof value === "object")
);
const localeURLs = [];
for (const path in filteredPathnames) {
if (filteredPathnames[path][locale]) {
localeURLs.push({
url: `${appUrl}${locale}${filteredPathnames[path][locale]}`,
lastModified: new Date(),
changeFrequency: "yearly",
priority: 1,
});
}
}
return [...localeURLs];
}Is there a way to get the locale from here?