Skip to content

Commit

Permalink
feat(tags): include TILs on tag pages
Browse files Browse the repository at this point in the history
  • Loading branch information
mateusfg7 committed Sep 14, 2024
1 parent 0d190fc commit 3f84cf9
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/app/blog/tag/[tag]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import {
} from '~/lib/tags'
import { getSortedPosts } from '~/lib/get-sorted-posts'
import { slug } from '~/lib/slug'
import { tils } from '#content'
import { TilList } from '~/components/til-list'
import { Title } from '~/components/title'

interface Props {
params: { tag: string }
Expand All @@ -27,16 +30,26 @@ export default function Page({ params }: Props) {
const { tag } = params

const postList = getSortedPosts(getPostListBasedOnTag(slug(tag)))
const tilList = tils.filter(til => til.tags.includes(tag))

return (
<div className="content-container m-auto">
<div className="content-container m-auto space-y-7">
<h1 className="mb-5 flex items-end justify-center gap-2 text-2xl font-bold md:justify-start">
{getNormalTagString(tag)}
<Tag size="1em" weight="duotone" />
</h1>
<main>
<PostList posts={postList} />
</main>
{postList.length > 0 && (
<div className="space-y-4">
<Title text="Blog Posts" />
<PostList posts={postList} />
</div>
)}
{tilList.length > 0 && (
<div className="space-y-4">
<Title text="T.I.L." />
<TilList tils={tilList} />
</div>
)}
</div>
)
}
Expand Down

0 comments on commit 3f84cf9

Please sign in to comment.