-
Notifications
You must be signed in to change notification settings - Fork 1
/
speaker-page.11ty.js
121 lines (110 loc) · 3.22 KB
/
speaker-page.11ty.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
import {
displaySpeakers,
displaySpeakerSocialBlock,
} from "./utils/speakers.js";
export default class SpeakerPage {
data() {
return {
layout: "layout.html",
currSection: "speakers",
pagination: {
data: "collections.speakersFromApi",
size: 1,
alias: "speaker",
},
permalink: (ctx) => {
return `speaker-page-${ctx.speaker.id}/`;
},
eleventyComputed: {
title: (ctx) => {
return ctx.speaker.display_name;
},
ogUrl: (ctx) => {
return "https://devlille.fr/speaker-page-" + ctx.speaker.id;
},
ogTitle: (ctx) => {
return ctx.speaker.display_name;
},
ogDescription: (ctx) => {
return ctx.speaker.bio?.replaceAll('"', "");
},
ogImage: (ctx) => {
return ctx.speaker.photo_url;
},
},
};
}
render(data) {
const speaker = data.collections.speakersFromApi.find(
(s) => s.id === data.speaker.id
);
let talks = Object.values(data.collections.talks)
.flat()
.map(([, talks]) => talks ?? [])
.reduce((acc, talks) => [...acc, ...talks], []);
const selectedTalks = talks.filter(
(talk) => talk.speakersIds?.indexOf(data.speaker.id) >= 0
);
if (selectedTalks.length === 0) {
return null;
}
return `
<div class="page-body list">
<h2>${speaker.display_name}${
speaker.pronouns ? ` (${speaker.pronouns})` : ""
}</h2>
<div class="speaker-sheet">
<div class="speaker">
${displaySpeakers(speaker)}
</div>
${displaySpeakerSocialBlock(speaker)}
<div class="talks">
${selectedTalks
.map((selectedTalk) => {
return `
<div class="talk">
<h3>${selectedTalk.talk?.title}</h3>
<p>${selectedTalk.talk?.abstract}</p>
${
selectedTalk.talk?.talk?.open_feedback
? `
<p class="openfeedback">
Suite à la conférence, vous pouvez faire un retour aux conférenciers et
conférencières sur
<a href="${selectedTalk.talk?.talk?.open_feedback}" target="_blank">OpenFeedback</a>
</p>
`
: ""
}
${
!!selectedTalk.talk?.talk?.link_slides ||
!!selectedTalk.talk?.talk?.link_replay
? `
<div class="talk-links">
<h4>Regardez ou re-regardez</h4>
<ul>
${
selectedTalk.talk?.talk?.link_replay
? `<li><a href="${selectedTalk.talk?.talk?.link_replay}">La vidéo du talk</a></li>`
: ""
}
${
selectedTalk.talk?.talk?.link_slides
? `<li><a href="${selectedTalk.talk?.talk?.link_slides}">Les slides du talk</a></li>`
: ""
}
</ul>
</div>
`
: ""
}
</div>
`;
})
.join("")}
</div>
</div>
</div>
`;
}
}