tags are now displayed in banner; adjusted sizing of elements in banner

This commit is contained in:
2026-04-02 16:15:02 +02:00
parent f932793b62
commit 83c6732b3a
4 changed files with 34 additions and 11 deletions

View File

@@ -6,6 +6,7 @@
subtitle = "", subtitle = "",
banner = "", banner = "",
bannerAlt = "", bannerAlt = "",
tags = [],
pixelated, pixelated,
}: { }: {
title: string; title: string;
@@ -14,18 +15,26 @@
subtitle?: string; subtitle?: string;
banner?: string; banner?: string;
bannerAlt?: string; bannerAlt?: string;
tags?: string[];
pixelated?: boolean; pixelated?: boolean;
} = $props(); } = $props();
</script> </script>
{#snippet titles({title, subtitle, date}: {title: string, subtitle: string, date: string})} {#snippet titles({title, subtitle, date}: {title: string, subtitle: string, date: string})}
<h1 class="title">{title}</h1>
<div class="title-container"> <div class="title-container">
<div class="title-text-container"> <div class="title-text-container">
<h1 class="title">{title}</h1>
{#if subtitle} {#if subtitle}
<p class="subtitle">[ {subtitle} ]</p> <p class="subtitle">[ {subtitle} ]</p>
{/if} {/if}
{#if tags}
<div class="tag-container">
{#each tags as tag}
<span class="post-tag">{tag}</span>
{/each}
</div>
{/if}
</div> </div>
{#if date} {#if date}
<div class="date-container"> <div class="date-container">
@@ -66,17 +75,23 @@
flex-direction: row; flex-direction: row;
/* align-items: flex-end; */ /* align-items: flex-end; */
gap: 16px; gap: 16px;
margin: var(--margin-header-top) 0 var(--margin-header-bottom) 0; margin: 8px 0;
}
.title-container + hr {
/* Add top margin if no date element exists */
margin-top: 16px;
} }
.title-text-container { .title-text-container {
width: fit-content; width: fit-content;
display: flex;
flex-direction: column;
flex: 1; flex: 1;
gap: 8px;
}
.tag-container {
display: flex;
gap: 4px;
flex-direction: row;
flex-wrap: wrap;
margin-bottom: 4px;
} }
.date-container { .date-container {
@@ -84,13 +99,13 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: flex-end; align-items: flex-end;
margin-bottom: 12px;
} }
.title { .title {
box-sizing: border-box; box-sizing: border-box;
height: fit-content; height: fit-content;
margin: 0; margin: 0;
margin-top: var(--margin-header-top);
} }
.date { .date {
@@ -108,6 +123,7 @@
/* width: fit-content; */ /* width: fit-content; */
font-weight: 500; font-weight: 500;
font-size: 1.0rem; font-size: 1.0rem;
line-height: 1.0rem;
margin: 0; margin: 0;
} }

View File

@@ -15,10 +15,12 @@
<Content> <Content>
<Banner2 <Banner2
title="{data.title}" title="{data.title}"
subtitle="{data.subtitle}"
date="{data.date}" date="{data.date}"
dateUpdated="{data.dateUpdated}" dateUpdated="{data.dateUpdated}"
banner="{data.banner}" banner="{data.banner}"
bannerAlt="Banner for blog post '{data.title}'" /> bannerAlt="Banner for blog post '{data.title}'"
tags={data.tags} />
<TableOfContents /> <TableOfContents />

View File

@@ -1,26 +1,30 @@
import { posts, type BlogPostLink } from '../../posts'; import { BlogPostTag, posts, type BlogPostLink } from '../../posts';
export async function load({ params }) { export async function load({ params }) {
const post = await import(`../../${params.year}/${params.date}.md`); 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 postValues = posts.find((v: BlogPostLink) => v.key == tag)?.post;
const content = post.default; const content = post.default;
const title: string = postValues?.title ?? ""; const title: string = postValues?.title ?? "";
const subtitle: string = postValues?.subtitle ?? "";
const date: string = postValues?.date ?? ""; const date: string = postValues?.date ?? "";
const dateUpdated: string = postValues?.dateUpdated ?? ""; const dateUpdated: string = postValues?.dateUpdated ?? "";
const time: string = postValues?.time ?? ""; const time: string = postValues?.time ?? "";
const banner: string = postValues?.banner ?? ""; const banner: string = postValues?.banner ?? "";
const description: string = postValues?.description ?? ""; const description: string = postValues?.description ?? "";
const tags: BlogPostTag[] = postValues?.tags ?? []; // blog post tags. should be renamed 'keywords'
return { return {
content, content,
title, title,
subtitle,
banner, banner,
date, date,
dateUpdated, dateUpdated,
time, time,
tag, tag,
tags,
description, description,
}; };
} }

View File

@@ -11,6 +11,7 @@ export interface BlogPostDetails {
bannerAlt: string; bannerAlt: string;
title: string; title: string;
subtitle?: string;
/** /**
* Description to be used in page's metadata. * Description to be used in page's metadata.