portfolio/app/sitemap.ts
Ryan Freeman 6c0100e9a3
All checks were successful
Build And Publish / BuildAndPublish (push) Successful in 2m39s
Added new page
2024-10-09 21:49:31 +01:00

26 lines
788 B
TypeScript

import {MetadataRoute} from 'next'
import {getAllArticles} from '@/lib/getAllArticles'
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
const urls = [
'https://ryanfreeman.dev/',
'https://ryanfreeman.dev/about',
'https://ryanfreeman.dev/services',
'https://ryanfreeman.dev/reading',
'https://ryanfreeman.dev/writing',
'https://ryanfreeman.dev/projects',
'https://ryanfreeman.dev/uses'
]
const pages = urls.map(url => ({
url,
lastModified: new Date()
}))
const posts = (await getAllArticles()).map(({slug, date}) => ({
url: `https://ryanfreeman.dev/writing/${slug}/`,
lastModified: new Date(date).toISOString()
}))
return [...pages, ...posts]
}