Skip to content

Commit 885fbc9

Browse files
Add keynoter conditional link to speakers list. (#1168)
Update for keynoters section on the home page. Add Keynoter link to speakers list if speaker slug exists on the list of speakers. ![image](https://github.com/user-attachments/assets/4da3c16f-261b-4a2f-b95a-dda5245bee1a) --------- Co-authored-by: Mia Bajić <[email protected]>
1 parent 335f757 commit 885fbc9

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

src/components/keynoters/keynoter.astro

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
import type { ImageMetadata } from "astro";
3+
import { getCollection } from "astro:content";
34
import { Image } from "astro:assets";
45
import Person1 from "../placeholders/person-1.astro";
56
import Person2 from "../placeholders/person-2.astro";
@@ -19,6 +20,7 @@ export interface Props {
1920
2021
const {
2122
name,
23+
slug,
2224
tagline,
2325
image,
2426
placeholder,
@@ -30,10 +32,12 @@ const placeholders = [Person1, Person2, Person3, Person4, Person5];
3032
const Placeholder =
3133
placeholders[Math.floor(Math.random() * placeholders.length)];
3234
35+
const entries = await getCollection("speakers");
36+
const isSpeaker = entries.some((entry) => entry.id === slug);
3337
---
3438

3539
<li class:list={["list-none rounded-2xl overflow-clip flex group", className]}>
36-
<a class="block w-full h-full relative " >
40+
<div class="block w-full h-full relative">
3741
<div class="relative aspect-[9/10] overflow-clip">
3842
{
3943
image ? (
@@ -51,21 +55,30 @@ const Placeholder =
5155
}
5256
</div>
5357

54-
<div
55-
class="px-5 py-2 pb-4 bg-keynoter-info rounded-t-none h-full "
56-
>
58+
<div class="px-5 py-2 pb-4 bg-keynoter-info rounded-t-none h-full">
5759
{
5860
placeholder ? (
59-
<p class="text-body-inverted ">More keynoters coming soon</p>
61+
<p class="text-body-inverted">More keynoters coming soon</p>
6062
) : (
6163
<>
62-
<p class="text-[#17223A] font-bold">{name}</p>
63-
{tagline ? (
64+
{isSpeaker ? (
65+
<p class="text-[#17223A] font-bold">
66+
<a
67+
href={`/speaker/${slug}`}
68+
class="text-[#17223A] font-bold hover:underline"
69+
>
70+
{name}
71+
</a>
72+
</p>
73+
) : (
74+
<p class="text-[#17223A] font-bold">{name}</p>
75+
)}
76+
{tagline && (
6477
<p class="text-secondary-hover text-lg italic">{tagline}</p>
65-
) : null}
78+
)}
6679
</>
6780
)
6881
}
6982
</div>
70-
</a>
83+
</div>
7184
</li>

0 commit comments

Comments
 (0)