mirror of
https://github.com/youwen5/site.git
synced 2024-11-28 10:53:50 -08:00
feat: show post cover on article page
This commit is contained in:
parent
f26765dda5
commit
4f654abd49
3 changed files with 8 additions and 2 deletions
3
src/globals.d.ts
vendored
3
src/globals.d.ts
vendored
|
@ -5,7 +5,7 @@ interface BlogDocument {
|
||||||
primaryTags: string[];
|
primaryTags: string[];
|
||||||
secondaryTags: string[];
|
secondaryTags: string[];
|
||||||
blurb: string;
|
blurb: string;
|
||||||
image?: string;
|
image: { src: string; alt: string; caption: string };
|
||||||
description: string;
|
description: string;
|
||||||
slug;
|
slug;
|
||||||
}
|
}
|
||||||
|
@ -24,5 +24,6 @@ type PostMeta = {
|
||||||
cover: {
|
cover: {
|
||||||
src: string;
|
src: string;
|
||||||
alt: string;
|
alt: string;
|
||||||
|
caption: string;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -23,6 +23,10 @@
|
||||||
reverseDateAndRest
|
reverseDateAndRest
|
||||||
/>
|
/>
|
||||||
</div>
|
</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>
|
</header>
|
||||||
|
|
||||||
<div class="markdown-body mb-8 font-serif">
|
<div class="markdown-body mb-8 font-serif">
|
||||||
|
|
|
@ -19,7 +19,8 @@
|
||||||
content: data.content,
|
content: data.content,
|
||||||
blurb: data.metadata.manifest.blurb,
|
blurb: data.metadata.manifest.blurb,
|
||||||
description: data.metadata.manifest.description,
|
description: data.metadata.manifest.description,
|
||||||
slug: data.slug
|
slug: data.slug,
|
||||||
|
image: data.metadata.cover
|
||||||
};
|
};
|
||||||
// $: doc = data.metadata;
|
// $: doc = data.metadata;
|
||||||
// $: componentSource = data.metadata.source?.replace('default', $config.style ?? 'default');
|
// $: componentSource = data.metadata.source?.replace('default', $config.style ?? 'default');
|
||||||
|
|
Loading…
Reference in a new issue