From 5a1e398c30613d5c6a280b4e29d251ed83878b0c Mon Sep 17 00:00:00 2001 From: trivernis Date: Sat, 6 Jul 2024 19:05:35 +0200 Subject: [PATCH] Add teaser image to blog page headers --- src/routes/blog/[slug]/+page.svelte | 75 ++++++++++++++++++++++++----- 1 file changed, 64 insertions(+), 11 deletions(-) diff --git a/src/routes/blog/[slug]/+page.svelte b/src/routes/blog/[slug]/+page.svelte index 74edff9..702c2e8 100644 --- a/src/routes/blog/[slug]/+page.svelte +++ b/src/routes/blog/[slug]/+page.svelte @@ -1,28 +1,81 @@ {#if data.post} - - {@const post = data.post} - {@const author = data.post.attributes.author.data?.attributes} - -

{post.attributes.title}

-

by {author?.name}

+ {@const post = data.post} + {@const author = data.post.attributes.author.data?.attributes} + {@const teaserImage = data.post.attributes.teaserImage.data?.attributes} + {@const collection = data.post.attributes.collection.data?.attributes} +
+ +
+

{post.attributes.title}

+

by {author?.name}

+ {#if collection} +

in {collection?.name}

+ {/if} + {formatDateRelative(post.attributes.publishedAt)} +
+ {#if post.attributes.teaserImage.data} +
+ +
+ {/if} +
+
+ {#each post.attributes.content as contentEntry} - + {/each} - {:else} - +{:else} + {/if} {#if data.error} {/if} + +