first
This commit is contained in:
commit
8538ab969a
434 changed files with 44051 additions and 0 deletions
43
apps/web/app/sitemap.ts
Normal file
43
apps/web/app/sitemap.ts
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
import { getAllPosts } from "@marketing/blog/utils/lib/posts";
|
||||
import { config } from "@repo/config";
|
||||
import { getBaseUrl } from "@repo/utils";
|
||||
import { allLegalPages } from "content-collections";
|
||||
import type { MetadataRoute } from "next";
|
||||
import { docsSource } from "./docs-source";
|
||||
|
||||
const baseUrl = getBaseUrl();
|
||||
const locales = config.i18n.enabled
|
||||
? Object.keys(config.i18n.locales)
|
||||
: [config.i18n.defaultLocale];
|
||||
|
||||
const staticMarketingPages = ["", "/changelog"];
|
||||
|
||||
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
|
||||
const posts = await getAllPosts();
|
||||
|
||||
return [
|
||||
...staticMarketingPages.flatMap((page) =>
|
||||
locales.map((locale) => ({
|
||||
url: new URL(`/${locale}${page}`, baseUrl).href,
|
||||
lastModified: new Date(),
|
||||
})),
|
||||
),
|
||||
...posts.map((post) => ({
|
||||
url: new URL(`/${post.locale}/blog/${post.path}`, baseUrl).href,
|
||||
lastModified: new Date(),
|
||||
})),
|
||||
...allLegalPages.map((page) => ({
|
||||
url: new URL(`/${page.locale}/legal/${page.path}`, baseUrl).href,
|
||||
lastModified: new Date(),
|
||||
})),
|
||||
...docsSource.getLanguages().flatMap((locale) =>
|
||||
docsSource.getPages(locale.language).map((page) => ({
|
||||
url: new URL(
|
||||
`/${locale.language}/docs/${page.slugs.join("/")}`,
|
||||
baseUrl,
|
||||
).href,
|
||||
lastModified: new Date(),
|
||||
})),
|
||||
),
|
||||
];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue