Skip to content

Commit e4b6438

Browse files
authored
Merge pull request #778 from zziri/dev/sitemap-draft-not-include
draft posts should not be included in the sitemap
2 parents a17e244 + fa262d0 commit e4b6438

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

app/sitemap.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@ import siteMetadata from '@/data/siteMetadata'
44

55
export default function sitemap(): MetadataRoute.Sitemap {
66
const siteUrl = siteMetadata.siteUrl
7-
const blogRoutes = allBlogs.map((post) => ({
8-
url: `${siteUrl}/${post.path}`,
9-
lastModified: post.lastmod || post.date,
10-
}))
7+
8+
const blogRoutes = allBlogs
9+
.filter((post) => !post.draft)
10+
.map((post) => ({
11+
url: `${siteUrl}/${post.path}`,
12+
lastModified: post.lastmod || post.date,
13+
}))
1114

1215
const routes = ['', 'blog', 'projects', 'tags'].map((route) => ({
1316
url: `${siteUrl}/${route}`,

0 commit comments

Comments
 (0)