This commit is contained in:
Sergey Yarkov 2026-02-25 08:11:32 +03:00
parent eca47d8ce3
commit f3e4b3b9d8
2 changed files with 12 additions and 11 deletions

View File

@ -1,4 +1,4 @@
User-agent: *
Allow: /
Sitemap: https://yarkov.tech/sitemap-index.xml
Sitemap: https://yarkov.tech/sitemap.xml

View File

@ -10,8 +10,8 @@ export async function GET(context: APIContext) {
const articles = await getArticleList();
const baseUrls: Array<SitemapURL> = [
{ loc: `/`, changefreq: "weekly", priority: 1.0 },
{ loc: `/articles/`, changefreq: "weekly", priority: 0.9 },
{ loc: `/`, changefreq: "monthly", priority: 1.0 },
{ loc: `/articles/`, changefreq: "monthly", priority: 0.9 },
{ loc: `/projects/`, changefreq: "monthly", priority: 0.8 },
{ loc: `/about/`, changefreq: "monthly", priority: 0.7 },
];
@ -65,14 +65,15 @@ export async function GET(context: APIContext) {
})
.join("")}
${articleUrls
.map((url) => {
return `
<url>
<loc>${url.loc}</loc>
${url.langs?.map(({ lang, href }) => `<xhtml:link rel="alternate" hreflang="${lang}" href="${href}"/>`).join("")}
</url>
`;
})
.map(
(url) =>
`
<url>
<loc>${url.loc}</loc>
${url.langs?.map(({ lang, href }) => `<xhtml:link rel="alternate" hreflang="${lang}" href="${href}"/>`).join("")}
</url>
`
)
.join("")}
</urlset>`;