Skip to content

Commit

Permalink
fix(seo): use slug version of tag/category link on sitemap
Browse files Browse the repository at this point in the history
  • Loading branch information
mateusfg7 committed Jun 19, 2023
1 parent b1e5ed9 commit 9b13834
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/app/sitemap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { getUniqueCategoryList } from '@/shared/lib/categories'
import { getUniqueTagListFromPosts } from '@/shared/lib/tags'
import { host } from '@/shared/lib/webserver-constants'
import { allPosts } from 'contentlayer/generated'
import { slug } from '@/shared/lib/slug'

export default function sitemap(): MetadataRoute.Sitemap {
const commonRoutes = ['', 'categories', 'feed', 'tag', 'portifolio'].map(
Expand All @@ -13,11 +14,11 @@ export default function sitemap(): MetadataRoute.Sitemap {
)

const tags = getUniqueTagListFromPosts().map(tag => ({
url: `${host}/tag/${tag}`,
url: `${host}/tag/${slug(tag)}`,
lastModified: new Date().toISOString()
}))
const categories = getUniqueCategoryList().map(category => ({
url: `${host}/categories/${category}`,
url: `${host}/categories/${slug(category)}`,
lastModified: new Date().toISOString()
}))
const posts = allPosts.map(post => ({
Expand Down

0 comments on commit 9b13834

Please sign in to comment.