Added site functions

This commit is contained in:
2026-09-22 13:37:08 +02:00
parent 854f4af393
commit 5cad56000c
8 changed files with 261 additions and 3 deletions

5
src/lib/content/dates.ts Normal file
View File

@@ -0,0 +1,5 @@
export function parseDate(value: string | null): Date | null {
if (!value) return null
const date = new Date(/(z|[+-]\d\d:\d\d)$/i.test(value) ? value : `${value}Z`)
return Number.isNaN(date.getTime()) ? null : date
}

View File

@@ -10,7 +10,7 @@ export type ArticleEntry = Entry<Collections['articles']>
export type PageEntry = Entry<Collections['pages']>
export type TagEntry = Entry<Collections['tags']>
export interface Content {
export type Content = {
articles: Map<string, ArticleEntry>
pages: Map<string, PageEntry>
tags: Map<string, TagEntry>