Skip to content

Commit

Permalink
feat: add link functionality to tags in Tag component
Browse files Browse the repository at this point in the history
  • Loading branch information
thisisrick25 committed Jan 8, 2024
1 parent 436905c commit e03ac54
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions components/tag.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import Link from "next/link"
import githubSlugger from "github-slugger"

//@ts-ignore
export default function Tag({ blog }) {
const slugger = new githubSlugger()

return (
<div className="text-neutral-600 dark:text-neutral-400 text-base rounded-lg mb-4 overflow-hidden overflow-y-auto ">
{//@ts-ignore
blog.tags.map((tag, index) => {
return (
<>
<a href={`#${tag}`}>
<Link href={`/categories/${slugger.slug(tag)}`}>
<span className="hover:underline">{`#${tag}`}</span>
</a>
</Link>
{index !== blog.tags.length - 1 && ", "} {/* Add a comma after each tag except the last one */}
</>
)
Expand Down

0 comments on commit e03ac54

Please sign in to comment.