diff --git a/src/lib/banner2.svelte b/src/lib/banner2.svelte index 4e8bf7f..9f60b5b 100644 --- a/src/lib/banner2.svelte +++ b/src/lib/banner2.svelte @@ -6,6 +6,7 @@ subtitle = "", banner = "", bannerAlt = "", + tags = [], pixelated, }: { title: string; @@ -14,18 +15,26 @@ subtitle?: string; banner?: string; bannerAlt?: string; + tags?: string[]; pixelated?: boolean; } = $props(); {#snippet titles({title, subtitle, date}: {title: string, subtitle: string, date: string})} +

{title}

-

{title}

{#if subtitle}

[ {subtitle} ]

{/if} + {#if tags} +
+ {#each tags as tag} + + {/each} +
+ {/if}
{#if date}
@@ -66,17 +75,23 @@ flex-direction: row; /* align-items: flex-end; */ gap: 16px; - margin: var(--margin-header-top) 0 var(--margin-header-bottom) 0; - } - - .title-container + hr { - /* Add top margin if no date element exists */ - margin-top: 16px; + margin: 8px 0; } .title-text-container { width: fit-content; + display: flex; + flex-direction: column; flex: 1; + gap: 8px; + } + + .tag-container { + display: flex; + gap: 4px; + flex-direction: row; + flex-wrap: wrap; + margin-bottom: 4px; } .date-container { @@ -84,13 +99,13 @@ display: flex; flex-direction: column; align-items: flex-end; - margin-bottom: 12px; } .title { box-sizing: border-box; height: fit-content; margin: 0; + margin-top: var(--margin-header-top); } .date { @@ -108,6 +123,7 @@ /* width: fit-content; */ font-weight: 500; font-size: 1.0rem; + line-height: 1.0rem; margin: 0; } diff --git a/src/routes/blog/[year]/[date]/+page.svelte b/src/routes/blog/[year]/[date]/+page.svelte index 8564896..1a763a4 100644 --- a/src/routes/blog/[year]/[date]/+page.svelte +++ b/src/routes/blog/[year]/[date]/+page.svelte @@ -15,10 +15,12 @@ + bannerAlt="Banner for blog post '{data.title}'" + tags={data.tags} /> diff --git a/src/routes/blog/[year]/[date]/+page.ts b/src/routes/blog/[year]/[date]/+page.ts index 5e70e98..224c69a 100644 --- a/src/routes/blog/[year]/[date]/+page.ts +++ b/src/routes/blog/[year]/[date]/+page.ts @@ -1,26 +1,30 @@ -import { posts, type BlogPostLink } from '../../posts'; +import { BlogPostTag, posts, type BlogPostLink } from '../../posts'; export async function load({ params }) { const post = await import(`../../${params.year}/${params.date}.md`); - const tag: string = `${params.year}/${params.date}`; + const tag: string = `${params.year}/${params.date}`; // link to the page. not to be confused with tags. i know it's confusing naming const postValues = posts.find((v: BlogPostLink) => v.key == tag)?.post; const content = post.default; const title: string = postValues?.title ?? ""; + const subtitle: string = postValues?.subtitle ?? ""; const date: string = postValues?.date ?? ""; const dateUpdated: string = postValues?.dateUpdated ?? ""; const time: string = postValues?.time ?? ""; const banner: string = postValues?.banner ?? ""; const description: string = postValues?.description ?? ""; + const tags: BlogPostTag[] = postValues?.tags ?? []; // blog post tags. should be renamed 'keywords' return { content, title, + subtitle, banner, date, dateUpdated, time, tag, + tags, description, }; } \ No newline at end of file diff --git a/src/routes/blog/posts.ts b/src/routes/blog/posts.ts index aff52ba..8fb6072 100644 --- a/src/routes/blog/posts.ts +++ b/src/routes/blog/posts.ts @@ -11,6 +11,7 @@ export interface BlogPostDetails { bannerAlt: string; title: string; + subtitle?: string; /** * Description to be used in page's metadata.