Add blog utilities and tag pages
CI / ci (push) Successful in 29s
CI / ci (pull_request) Successful in 29s
Docker / docker (pull_request) Successful in 17s

Introduce formatBlogDate, slugifyTag and getTagHref in src/lib/blog.ts
and
a reading time helper getReadingTime in src/lib/readingTime.ts. Update
blog index and post pages to display ISO dates, reading times and link
tags to /blog/tag/<slug>. Add a tag listing page at
src/pages/blog/tag/[tag].astro with styles and static paths generation
This commit is contained in:
2026-03-07 17:46:15 +01:00
parent 45059fcd53
commit 7e3299e3bd
5 changed files with 554 additions and 23 deletions
+17
View File
@@ -0,0 +1,17 @@
export function formatBlogDate(date: Date) {
return date.toISOString().split("T")[0];
}
export function slugifyTag(tag: string) {
return tag
.toLowerCase()
.trim()
.replace(/&/g, " and ")
.replace(/[^a-z0-9\s-]/g, "")
.replace(/\s+/g, "-")
.replace(/-+/g, "-");
}
export function getTagHref(tag: string) {
return `/blog/tag/${slugifyTag(tag)}`;
}