[dev/sitemap-draft-not-include] draft posts are not included in the sitemap

This commit is contained in:
zziri 2023-11-17 18:51:15 +09:00
parent a17e244770
commit f6762c350a

View File

@ -4,10 +4,12 @@ import siteMetadata from '@/data/siteMetadata'
export default function sitemap(): MetadataRoute.Sitemap {
const siteUrl = siteMetadata.siteUrl
const blogRoutes = allBlogs.map((post) => ({
url: `${siteUrl}/${post.path}`,
lastModified: post.lastmod || post.date,
}))
const blogRoutes = allBlogs.filter((post) => !post.draft)
.map((post) => ({
url: `${siteUrl}/${post.path}`,
lastModified: post.lastmod || post.date,
}))
const routes = ['', 'blog', 'projects', 'tags'].map((route) => ({
url: `${siteUrl}/${route}`,