seo: add tag pages to sitemap

master
Ivan Reshetnikov 2024-03-06 20:36:50 +05:00
parent 8bc1493821
commit 8dde510a59
No known key found for this signature in database
GPG Key ID: 56C7BAAE859B302C
1 changed files with 8 additions and 0 deletions

View File

@ -11,6 +11,14 @@ export async function GET(context: APIContext) {
<url><loc>${context.site}services</loc></url>
<url><loc>${context.site}cinema</loc></url>`
notes
.map(entry => entry.data.tags)
.flat()
.filter((tag, i, self) => self.findIndex(t => t.slug === tag.slug) === i)
.forEach(tag => {
sitemap += `<url><loc>${context.site}tags/${tag.slug}</loc></url>`
})
notes.forEach(note => {
sitemap += `<url><loc>${context.site}notes/${note.slug}</loc></url>`
})