feat: show post cover on article page

This commit is contained in:
Youwen Wu 2024-04-12 22:48:25 -07:00
parent f26765dda5
commit 4f654abd49
Signed by: youwen5
GPG key ID: 865658ED1FE61EC3
3 changed files with 8 additions and 2 deletions

3
src/globals.d.ts vendored
View file

@ -5,7 +5,7 @@ interface BlogDocument {
primaryTags: string[];
secondaryTags: string[];
blurb: string;
image?: string;
image: { src: string; alt: string; caption: string };
description: string;
slug;
}
@ -24,5 +24,6 @@ type PostMeta = {
cover: {
src: string;
alt: string;
caption: string;
};
};

View file

@ -23,6 +23,10 @@
reverseDateAndRest
/>
</div>
<figure class="w-[80%]">
<img src={doc.image.src} alt={doc.image.alt} class="rounded-xl shadow-md" />
<figcaption class="mt-2 text-center text-muted-foreground">{doc.image.caption}</figcaption>
</figure>
</header>
<div class="markdown-body mb-8 font-serif">

View file

@ -19,7 +19,8 @@
content: data.content,
blurb: data.metadata.manifest.blurb,
description: data.metadata.manifest.description,
slug: data.slug
slug: data.slug,
image: data.metadata.cover
};
// $: doc = data.metadata;
// $: componentSource = data.metadata.source?.replace('default', $config.style ?? 'default');