From 5e383e05e6519ffd4983d64d91165ce1611be47a Mon Sep 17 00:00:00 2001 From: Niko Date: Wed, 23 Apr 2025 12:28:05 +0200 Subject: [PATCH 1/2] Add keynoter conditional link to speakers list. --- src/components/keynoters/keynoter.astro | 26 +++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/components/keynoters/keynoter.astro b/src/components/keynoters/keynoter.astro index 9767b0337..9d2a050eb 100644 --- a/src/components/keynoters/keynoter.astro +++ b/src/components/keynoters/keynoter.astro @@ -1,5 +1,6 @@ --- import type { ImageMetadata } from "astro"; +import { getCollection } from "astro:content"; import { Image } from "astro:assets"; import Person1 from "../placeholders/person-1.astro"; import Person2 from "../placeholders/person-2.astro"; @@ -19,6 +20,7 @@ export interface Props { const { name, + slug, tagline, image, placeholder, @@ -30,10 +32,14 @@ const placeholders = [Person1, Person2, Person3, Person4, Person5]; const Placeholder = placeholders[Math.floor(Math.random() * placeholders.length)]; + + const entries = await getCollection("speakers"); + const isSpeaker = entries.some((entry) => entry.id === slug) + ---
  • - +
  • From 9c530f118e1b7b472ab8b37f8efe44e5c6c4d086 Mon Sep 17 00:00:00 2001 From: Niko Date: Wed, 23 Apr 2025 15:39:41 +0200 Subject: [PATCH 2/2] Format code. --- src/components/keynoters/keynoter.astro | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/components/keynoters/keynoter.astro b/src/components/keynoters/keynoter.astro index 9d2a050eb..2de3f3aca 100644 --- a/src/components/keynoters/keynoter.astro +++ b/src/components/keynoters/keynoter.astro @@ -32,14 +32,12 @@ const placeholders = [Person1, Person2, Person3, Person4, Person5]; const Placeholder = placeholders[Math.floor(Math.random() * placeholders.length)]; - - const entries = await getCollection("speakers"); - const isSpeaker = entries.some((entry) => entry.id === slug) - +const entries = await getCollection("speakers"); +const isSpeaker = entries.some((entry) => entry.id === slug); ---
  • -
    +
    { image ? ( @@ -57,20 +55,21 @@ const Placeholder = }
    -
    +
    { placeholder ? (

    More keynoters coming soon

    ) : ( <> {isSpeaker ? ( -

    - - {name} - -

    +

    + + {name} + +

    ) : (

    {name}

    )}