Skip to content

Commit

Permalink
Merge pull request timlrx#989 from ray-android/patch-2
Browse files Browse the repository at this point in the history
Fix issue timlrx#988
  • Loading branch information
timlrx authored Aug 11, 2024
2 parents 6b5287e + 30e77ed commit 80bb673
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/tags/[tag]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { allBlogs } from 'contentlayer/generated'
import tagData from 'app/tag-data.json'
import { genPageMetadata } from 'app/seo'
import { Metadata } from 'next'
import { notFound } from 'next/navigation'

export async function generateMetadata({ params }: { params: { tag: string } }): Promise<Metadata> {
const tag = decodeURI(params.tag)
Expand Down Expand Up @@ -37,5 +38,8 @@ export default function TagPage({ params }: { params: { tag: string } }) {
const filteredPosts = allCoreContent(
sortPosts(allBlogs.filter((post) => post.tags && post.tags.map((t) => slug(t)).includes(tag)))
)
if (filteredPosts.length === 0) {
return notFound()
}
return <ListLayout posts={filteredPosts} title={title} />
}

0 comments on commit 80bb673

Please sign in to comment.