18 lines
470 B
TypeScript
18 lines
470 B
TypeScript
import { getBlogPosts } from '@/blog/utils'
|
|
|
|
export const baseUrl = 'https://portfolio-blog-starter.vercel.app'
|
|
|
|
export default async function sitemap() {
|
|
let blogs = getBlogPosts().map((post) => ({
|
|
url: `${baseUrl}/blog/${post.slug}`,
|
|
lastModified: post.metadata.publishedAt,
|
|
}))
|
|
|
|
let routes = ['', '/blog'].map((route) => ({
|
|
url: `${baseUrl}${route}`,
|
|
lastModified: new Date().toISOString().split('T')[0],
|
|
}))
|
|
|
|
return [...routes, ...blogs]
|
|
}
|