seo: add tag pages to sitemap

This commit is contained in:
Ivan R. 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

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>`
})