mirror of
https://github.com/TheRealOwenRees/echecsfrance.git
synced 2026-07-23 12:36:57 +00:00
Reorganise code - use src folder
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import { MetadataRoute } from "next";
|
||||
|
||||
import { locales, pathnames } from "@/utils/navigation";
|
||||
|
||||
export default function sitemap(): MetadataRoute.Sitemap {
|
||||
return locales.flatMap((locale) => {
|
||||
const prefix = `https://echecsfrance.com${
|
||||
locale === "fr" ? "" : `/${locale}`
|
||||
}`;
|
||||
|
||||
const paths = Object.keys(pathnames) as Array<keyof typeof pathnames>;
|
||||
|
||||
return paths.map((pathname) => {
|
||||
const route = pathnames[pathname];
|
||||
if (typeof route === "string") {
|
||||
return {
|
||||
url: `${prefix}${route}`,
|
||||
lastModified: new Date(),
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
url: `${prefix}${route[locale]}`,
|
||||
lastModified: new Date(),
|
||||
};
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user