-
Notifications
You must be signed in to change notification settings - Fork 1
/
talk-page.11ty.js
114 lines (105 loc) · 2.55 KB
/
talk-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
const displayOpenFeedBackBlock = (talk) => {
if (!talk?.open_feedback) {
return "";
}
return `
<p>
Suite à la conférence, vous pouvez faire un retour aux conférenciers et
conférencières sur
<a href="${talk?.open_feedback}" target="_blank">OpenFeedback</a>
</p>
`;
};
export const displayReplayBlock = (talk) => {
if (!talk?.link_slides && !talk.link_replay) {
return "";
}
return `
<div class="talk-links">
<h4>Regardez ou re-regardez</h4>
<ul>
${
talk?.link_replay
? `<li><a href="${talk?.link_replay}">La vidéo du talk</a></li>`
: ""
}
${
talk?.link_slides
? `<li><a href="${talk?.link_slides}">Les slides du talk</a></li>`
: ""
}
</ul>
</div>
`;
};
export default class Page {
data() {
return {
layout: "layout.html",
currSection: "talks",
pagination: {
data: "collections.flatTalks",
size: 1,
alias: "talk",
},
permalink: (ctx) => {
return `talk-page-${ctx.talk.id}/`;
},
eleventyComputed: {
title: (ctx) => {
return ctx.talk.title;
},
ogUrl: (ctx) => {
return "https://devlille.fr/talk-page-" + ctx.talk.id;
},
ogTitle: (ctx) => {
return ctx.talk.title;
},
ogDescription: (ctx) => {
return ctx.talk.title.replaceAll('"', "");
},
},
};
}
render({ talk }) {
if (!talk.talk && !talk.info) {
return null;
}
talk.talk = talk.talk ?? talk.info;
const speakers = talk.talk.speakers;
return `
<div class="page-body list">
<h2>${talk.title}</h2>
<div class="speaker-sheet">
<div class="speaker">
${talk.abstract}
</div>
<div class="speaker-data-block"></div>
${
talk.type === "event-session"
? ""
: `<div class="talks">
<div class="talk">
${displayOpenFeedBackBlock(talk?.talk)}
${displayReplayBlock(talk?.talk)}
</div>
${
speakers?.map((s) => {
return `
<div class="talk">
<h3>${s.display_name}</h3>
<p>${s.bio?.replaceAll('"', "")}</p>
<p><a href="/speaker-page-${s.id}">Page dédiée de ${
s.display_name
}</a></p>
</div>
`;
}) ?? ""
}
</div>`
}
</div>
</div>
`;
}
}