diff --git a/src/components/HeroCard.astro b/src/components/HeroCard.astro index 9d8bf76..8b4c6ec 100644 --- a/src/components/HeroCard.astro +++ b/src/components/HeroCard.astro @@ -25,10 +25,12 @@ const translatePath = useTranslatedPath(Astro.url); const t = useTranslations(Astro.url); const link = translatePath(`/${collection}/${id.split("/")[0]}`); + +const hasCover = typeof cover === "string" ? !!cover?.length : !!cover?.src; --- + classes={`grid gradient border-1 border-neutral overflow-hidden ${hasCover ? "grid-rows-[200px_1fr] xs:grid-rows-none xs:grid-cols-[1fr_200px]" : ""}`}> { (date || body || rating !== undefined) && ( @@ -57,11 +59,12 @@ const link = translatePath(`/${collection}/${id.split("/")[0]}`); { - cover && ( + hasCover && ( {"cover size.width)} @@ -92,5 +94,5 @@ const sizes = thumbnail .join(", ")}> - ) : undefined + ) :
{JSON.stringify({ image })}
} diff --git a/src/components/card/Metadata.svelte b/src/components/card/Metadata.svelte index d356bc8..28136de 100644 --- a/src/components/card/Metadata.svelte +++ b/src/components/card/Metadata.svelte @@ -34,21 +34,23 @@ }; -
- {#if rating} -
{formatRating(rating)}
- {/if} - {#if date} - - {/if} - {#if readDuration > 1} -
{readDuration} mins read
- {/if} - {#if author} -
{author}
- {/if} -
+{#if rating || date || readDuration || author} +
+ {#if rating} +
{formatRating(rating)}
+ {/if} + {#if date} + + {/if} + {#if readDuration > 1} +
{readDuration} mins read
+ {/if} + {#if author} +
{author}
+ {/if} +
+{/if}