jekyll-theme-conference 5.3.0 → 5.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +96 -49
  3. data/UPGRADE_GUIDE.md +16 -1
  4. data/_data/conference_assets.yml +3 -3
  5. data/_data/lang.yml +63 -39
  6. data/_includes/checks.html +9 -1
  7. data/_includes/conference_config.json +4 -4
  8. data/_includes/embed_consent.html +1 -1
  9. data/_includes/footer.html +2 -1
  10. data/_includes/get_edition.html +15 -0
  11. data/_includes/get_link.html +1 -1
  12. data/_includes/get_link_active.html +3 -1
  13. data/_includes/get_link_tag_streaming.html +22 -4
  14. data/_includes/get_menu.html +2 -2
  15. data/_includes/get_page_title.html +2 -2
  16. data/_includes/get_pwa_icon.html +10 -0
  17. data/_includes/header.html +3 -4
  18. data/_includes/infobox.html +6 -6
  19. data/_includes/list_header_pwa.html +11 -12
  20. data/_includes/modal_link.html +4 -3
  21. data/_includes/modal_live.html +5 -52
  22. data/_includes/navbar.html +4 -3
  23. data/_includes/navbar_pwa.html +2 -1
  24. data/_includes/pwa_install.html +4 -4
  25. data/_includes/pwa_toasts.html +39 -0
  26. data/_includes/show_link_buttons.html +1 -1
  27. data/_includes/show_stream.html +63 -0
  28. data/_layouts/htaccess.html +20 -7
  29. data/_layouts/json-site.html +15 -1
  30. data/_layouts/live.html +26 -0
  31. data/_layouts/location.html +1 -1
  32. data/_layouts/manifest.html +12 -10
  33. data/_layouts/not-found.html +23 -0
  34. data/_layouts/program.html +1 -1
  35. data/_layouts/speaker.html +1 -1
  36. data/_layouts/sw.js +141 -29
  37. data/_sass/bootstrap.scss +1 -0
  38. data/_sass/theme.scss +183 -124
  39. data/assets/css/conference-only.bundle.css +1 -1
  40. data/assets/css/conference.bundle.css +1 -1
  41. data/assets/js/conference.bundle.js +2 -2
  42. metadata +6 -3
  43. data/_includes/pwa_banner.html +0 -29
  44. data/_layouts/stream-overview.html +0 -45
@@ -0,0 +1,26 @@
1
+ {% include header.html %}
2
+ {%- assign live_lang = site.data.lang[site.conference.lang].live %}
3
+
4
+ <h1 class="display-5 mb-4 text-break">
5
+ {% if page.title %}
6
+ {{ page.title }}
7
+ {% else %}
8
+ {{ live_lang.stream | default: "Live stream" }}
9
+ {% endif %}
10
+ </h1>
11
+
12
+ {{ content }}
13
+
14
+ {%- comment -%}
15
+ The stream modal as a page, e.g. for the app's Live tab: the room of
16
+ the address (?room=Room+A, else the first), arranged in _css/theme.scss
17
+ {%- endcomment -%}
18
+ {%- if edition_live.streaming.enable %}
19
+ <div class="stream-page" id="stream">
20
+ {%- include show_stream.html %}
21
+ </div>
22
+ {%- else %}
23
+ <p>{{ live_lang.post_stream | default: "The live stream has ended." }}</p>
24
+ {%- endif %}
25
+
26
+ {% include footer.html %}
@@ -38,7 +38,7 @@
38
38
  {% if page.map %}
39
39
  {%- assign map_lang = site.data.lang[site.conference.lang].location -%}
40
40
  {%- assign map_css_version = site.data.conference_assets['css/map.bundle.css'] | default: site_version %}
41
- <div id="map" class="w-100 rounded shadow-sm" aria-label="{{ map_lang.map_label | default: 'Interactive conference location map' }}" data-map-css="{{ site.baseurl }}/assets/css/map.bundle.css?v={{ map_css_version }}">
41
+ <div id="map" role="region" class="w-100 rounded shadow-sm" aria-label="{{ map_lang.map_label | default: 'Interactive conference location map' }}" data-map-css="{{ site.baseurl }}/assets/css/map.bundle.css?v={{ map_css_version }}">
42
42
  <template data-map-icon>{% include icon.html name="star" %}</template>
43
43
  {%- unless page.map.click_to_load == false %}
44
44
  {%- comment -%} Privacy: tiles are only requested from the provider after consent {%- endcomment %}
@@ -1,11 +1,17 @@
1
1
  {%- include get_edition.html -%}
2
2
  {%- if site.conference.pwa and site.conference.pwa.enable -%}
3
+ {%- comment -%}
4
+ One app for all editions: name, identity and start do not depend on the
5
+ edition, so installed apps keep following the current one (the root
6
+ forwards to it, see _layouts/editions.html)
7
+ {%- endcomment -%}
3
8
  {
4
- "name": {{ edition_title | jsonify }},
5
- "short_name": {{ edition_title | jsonify }},
6
- "description": {{ edition_description | jsonify }},
9
+ "id": {{ site.baseurl | append: '/' | jsonify }},
10
+ "name": {{ site.title | jsonify }},
11
+ "short_name": {{ site.title | jsonify }},
12
+ "description": {{ site.description | jsonify }},
7
13
  "lang": {{ site.conference.lang | default: 'en' | jsonify }},
8
- "start_url": {{ site.baseurl | append: edition_base | append: '/' | jsonify }},
14
+ "start_url": {{ site.baseurl | append: '/' | jsonify }},
9
15
  "scope": {{ site.baseurl | append: '/' | jsonify }},
10
16
  "display": "standalone",
11
17
  "background_color": {{ site.conference.pwa.background_color | default: '#ffffff' | jsonify }},
@@ -14,12 +20,8 @@
14
20
  "icons": [
15
21
  {%- for icon in site.conference.pwa.icons %}
16
22
  {
17
- {%- if icon.first == nil -%}
18
- {%- assign icon_src = icon -%}
19
- {%- else -%}
20
- {%- assign icon_src = icon.img -%}
21
- {%- endif %}
22
- "src": {{ icon_src | prepend: '/assets/images/' | prepend: site.baseurl | jsonify }},
23
+ {%- include get_pwa_icon.html icon=icon %}
24
+ "src": {{ pwa_icon_url | jsonify }},
23
25
  {%- if icon.sizes %}
24
26
  "sizes": {{ icon.sizes | jsonify }},
25
27
  {%- endif -%}
@@ -0,0 +1,23 @@
1
+ {% include header.html %}
2
+ {%- comment -%}
3
+ Page for missing addresses (e.g. 404.md), also shown by the app's
4
+ service worker in place of the server's or when offline: links are
5
+ absolute, as it shows at any address
6
+ {%- endcomment -%}
7
+ {%- assign not_found_lang = site.data.lang[site.conference.lang].not_found %}
8
+
9
+ <h1 class="display-5 mb-3 text-break">
10
+ {{ page.title | default: not_found_lang.title | default: "Page not found" }}
11
+ </h1>
12
+
13
+ {%- comment -%} An empty Markdown page still holds a line break {%- endcomment -%}
14
+ {%- assign not_found_content = content | strip %}
15
+ {% if not_found_content != "" -%}
16
+ {{ content }}
17
+ {%- else -%}
18
+ <p class="lead">{{ not_found_lang.text | default: "This page does not exist (anymore)." }}</p>
19
+ {%- endif %}
20
+
21
+ <a class="btn btn-primary" href="{{ site.baseurl }}{{ edition_base }}/">{{ not_found_lang.home | default: "Go to the home page" }}</a>
22
+
23
+ {% include footer.html %}
@@ -279,7 +279,7 @@
279
279
 
280
280
  {%- if edition_tracks %}
281
281
  {%- unless page.hide_legend -%}
282
- <h2 class="h5 mt-4">{{ site.data.lang[site.conference.lang].program.legend | default: "Caption" }}</h2>
282
+ <h2 class="h5 mt-4">{{ site.data.lang[site.conference.lang].program.legend | default: "Legend" }}</h2>
283
283
  {%- for track_prop in edition_tracks %}
284
284
  <div class="track-name d-sm-inline-block m-1 bg-{{ track_prop.color | default: 'light' }}-subtle text-{{ track_prop.color | default: 'light' }}-emphasis border-{{ track_prop.color | default: 'light' }}-subtle">
285
285
  {%- if track_prop.icon -%}
@@ -27,7 +27,7 @@
27
27
  {% endif %}
28
28
 
29
29
  {% if has_regular_links > 0 %}
30
- <h2 class="h5 mt-4 mb-1">{{ site.data.lang[site.conference.lang].more_information | default: "More Information" }}:</h2>
30
+ <h2 class="h5 mt-4 mb-1">{{ site.data.lang[site.conference.lang].more_information | default: "More information" }}:</h2>
31
31
 
32
32
  <ul class="links-more list-unstyled">
33
33
  {% for link in speaker.links %}
data/_layouts/sw.js CHANGED
@@ -1,12 +1,28 @@
1
+ {%- include get_edition.html -%}
1
2
  const BASE_URL = "{{ site.baseurl }}";
2
3
  const VERSION = "{{ site.time | date: '%Y%m%d%H%M%S' }}";
3
4
  const CACHE_PREFIX = "jekyll-conference-theme-";
4
5
  const CACHE_NAME = `${CACHE_PREFIX}${VERSION}`;
5
6
 
6
- // Fall back to the cached page when the network is this slow, e.g. on a
7
- // crowded conference Wi-Fi (the response still updates the cache)
8
- const NETWORK_TIMEOUT_MS = 3000;
9
7
  const HTTP_NOT_MODIFIED = 304;
8
+ const HTTP_NOT_FOUND = 404;
9
+
10
+ // Message to the pages once a build changed the site (_js/modules/pwa.js)
11
+ const SITE_UPDATED = "site-updated";
12
+
13
+ // Pages of each build link the site's files with its build time (e.g.
14
+ // main.css?t=1793258390): ignored, so a rebuild alone is no update
15
+ const BUILD_TIME = /\?t=\d+/g;
16
+
17
+ // Whether this build changed the site: set on install, told the pages on
18
+ // activation
19
+ let siteUpdated = false;
20
+
21
+ // Whether the latest version differs from the stored one, ignoring the build time
22
+ const isChanged = async (stored, latest) => {
23
+ const [before, after] = await Promise.all([stored.text(), latest.text()]);
24
+ return before.replace(BUILD_TIME, "") !== after.replace(BUILD_TIME, "");
25
+ };
10
26
 
11
27
  // Copy of the previous build (cache), or nothing on the first install
12
28
  const previousCache = async () => {
@@ -16,11 +32,13 @@ const previousCache = async () => {
16
32
 
17
33
  // Store a resource in the new cache, downloading only what changed since the
18
34
  // previous build: theme bundles carry their content hash (e.g.
19
- // conference.bundle.css?v=1a2b3c), all other resources are revalidated (304)
35
+ // conference.bundle.css?v=1a2b3c), all other resources are revalidated (304).
36
+ // Resolves whether it changed.
20
37
  const precache = async (cache, previous, url) => {
21
38
  const cached = previous && (await previous.match(url));
22
39
  if (cached && new URL(url, self.location.href).searchParams.has("v")) {
23
- return cache.put(url, cached);
40
+ await cache.put(url, cached);
41
+ return false;
24
42
  }
25
43
 
26
44
  const headers = {};
@@ -31,14 +49,21 @@ const precache = async (cache, previous, url) => {
31
49
  headers["If-Modified-Since"] = cached.headers.get("Last-Modified");
32
50
  }
33
51
 
34
- const response = await fetch(url, { cache: "no-store", headers });
52
+ // Low priority: the visitor's own requests go first
53
+ const response = await fetch(url, { cache: "no-store", headers, priority: "low" });
35
54
  if (response.status === HTTP_NOT_MODIFIED && cached) {
36
- return cache.put(url, cached);
55
+ await cache.put(url, cached);
56
+ return false;
37
57
  }
38
58
  if (!response.ok) {
39
59
  throw new Error(`${response.status} ${url}`);
40
60
  }
41
- return cache.put(url, response);
61
+ await cache.put(url, response.clone());
62
+
63
+ // Example: main.css?t=1793258390 of the previous build. New resources
64
+ // change the pages linking them.
65
+ const stored = previous && (await previous.match(url, { ignoreSearch: true }));
66
+ return stored ? isChanged(stored, response) : false;
42
67
  };
43
68
 
44
69
  // Install event - precache all pages and assets listed in site.json
@@ -61,6 +86,7 @@ self.addEventListener("install", (event) => {
61
86
  if (failed.length) {
62
87
  console.warn(`Service worker could not cache ${failed.length} resource(s)`);
63
88
  }
89
+ siteUpdated = results.some((result) => result.value === true);
64
90
  } catch (error) {
65
91
  console.error("Service worker install failed:", error);
66
92
  }
@@ -75,6 +101,9 @@ self.addEventListener("install", (event) => {
75
101
  self.addEventListener("activate", (event) => {
76
102
  event.waitUntil(
77
103
  (async () => {
104
+ // Request pages while the service worker boots (see fromNetwork)
105
+ await self.registration.navigationPreload?.enable();
106
+
78
107
  const cacheNames = await caches.keys();
79
108
  await Promise.all(
80
109
  cacheNames
@@ -82,36 +111,108 @@ self.addEventListener("activate", (event) => {
82
111
  .map((name) => caches.delete(name)),
83
112
  );
84
113
  await self.clients.claim();
114
+
115
+ // Once for all pages of the build, e.g. not again on the next page
116
+ if (siteUpdated) {
117
+ const clients = await self.clients.matchAll({ type: "window" });
118
+ clients.forEach((client) => client.postMessage({ type: SITE_UPDATED }));
119
+ }
85
120
  })(),
86
121
  );
87
122
  });
88
123
 
89
- // Network first: latest page, data or asset version; when offline or the
90
- // network is too slow, the cached copy (ignoring the version query, e.g.
91
- // main.css?t=1793258390)
92
- const networkFirst = async (event) => {
93
- const { request } = event;
94
- const network = fetch(request).then(async (response) => {
95
- if (response.ok) {
96
- const cache = await caches.open(CACHE_NAME);
97
- await cache.put(request, response.clone());
98
- }
99
- return response;
100
- });
124
+ // Latest version from the network, e.g. the page's navigation preload
125
+ const fetchLatest = (event) =>
126
+ (event.preloadResponse ?? Promise.resolve()).then((preloaded) => preloaded || fetch(event.request));
127
+
128
+ // Store a response for later
129
+ const store = async (request, response) => {
130
+ if (response.ok) {
131
+ const cache = await caches.open(CACHE_NAME);
132
+ await cache.put(request, response.clone());
133
+ }
134
+ return response;
135
+ };
136
+
137
+ // Latest version from the network, stored for later
138
+ const fromNetwork = (event) => {
139
+ const network = fetchLatest(event).then((response) => store(event.request, response));
101
140
  event.waitUntil(network.catch(() => {}));
141
+ return network;
142
+ };
102
143
 
103
- const timeout = new Promise((resolve) => setTimeout(resolve, NETWORK_TIMEOUT_MS));
144
+ // Store the latest version of a page shown from the cache, unless it
145
+ // changed: the next build's service worker stores all its pages at once and
146
+ // tells the pages once (see install), instead of each page on its own
147
+ const revalidatePage = async (event, cached) => {
148
+ const response = await fetchLatest(event);
149
+ if (!response.ok) {
150
+ return;
151
+ }
152
+
153
+ if (await isChanged(cached, response.clone())) {
154
+ await self.registration.update();
155
+ return;
156
+ }
157
+ await store(event.request, response);
158
+ };
159
+
160
+ // Page for missing addresses (layout: not-found, e.g. /404.html), if any
161
+ {%- assign not_found_page = site.pages | where: "layout", "not-found" | where_exp: "p", "p.edition == nil" | first -%}
162
+ {%- assign not_found_url = nil -%}
163
+ {%- if not_found_page -%}
164
+ {%- assign not_found_url = not_found_page.url | prepend: site.baseurl -%}
165
+ {%- endif %}
166
+ const NOT_FOUND_URL = {{ not_found_url | jsonify }};
167
+
168
+ // The site's page not found in place of the server's (e.g. plain text), and
169
+ // offline for pages not stored
170
+ const notFound = async (response) => {
171
+ const page = NOT_FOUND_URL && (await caches.match(NOT_FOUND_URL));
172
+ if (!page) {
173
+ return response ?? Response.error();
174
+ }
175
+ return new Response(page.body, { status: HTTP_NOT_FOUND, headers: page.headers });
176
+ };
177
+
178
+ // Page not stored (e.g. a missing one): the network, else the page not found
179
+ const pageFromNetwork = async (event) => {
180
+ let response;
104
181
  try {
105
- const response = await Promise.race([network, timeout]);
106
- if (response) {
107
- return response;
108
- }
182
+ response = await fromNetwork(event);
109
183
  } catch {
110
- // Offline: answer from the cache below
184
+ return notFound();
111
185
  }
186
+ return response.status === HTTP_NOT_FOUND ? notFound(response) : response;
187
+ };
112
188
 
113
- const cached = await caches.match(request, { ignoreSearch: true });
114
- return cached || network;
189
+ // Stale while revalidate: the cached copy right away, also on a crowded
190
+ // conference Wi-Fi, updated in the background (ignoring the query, e.g.
191
+ // /program/?day=2); the network only without a copy
192
+ const staleWhileRevalidate = async (event) => {
193
+ const cached = await caches.match(event.request, { ignoreSearch: true });
194
+ const isPage = event.request.mode === "navigate";
195
+ if (!cached) {
196
+ return isPage ? pageFromNetwork(event) : fromNetwork(event);
197
+ }
198
+
199
+ if (isPage) {
200
+ event.waitUntil(revalidatePage(event, cached.clone()).catch(() => {}));
201
+ } else {
202
+ fromNetwork(event);
203
+ }
204
+ return cached;
205
+ };
206
+
207
+ // Network first: assets not in the cache; when offline, the cached copy
208
+ // ignoring the version query (e.g. main.css?t=1793258390)
209
+ const networkFirst = async (event) => {
210
+ const network = fromNetwork(event);
211
+ try {
212
+ return await network;
213
+ } catch {
214
+ return (await caches.match(event.request, { ignoreSearch: true })) || network;
215
+ }
115
216
  };
116
217
 
117
218
  // Cache first: versioned assets do not change once cached
@@ -129,6 +230,10 @@ const cacheFirst = async (event) => (await caches.match(event.request)) || netwo
129
230
  {%- endif %}
130
231
  const DOCUMENT_PATHS = {{ document_paths | jsonify }};
131
232
 
233
+ // Start of the current edition, e.g. /2026/, to which the root forwards
234
+ // (without editions: the root itself)
235
+ const EDITION_URL = `${BASE_URL}{{ edition_base }}/`;
236
+
132
237
  // Fetch event - only handle same-origin GET requests within the site,
133
238
  // except the service worker itself and documents
134
239
  self.addEventListener("fetch", (event) => {
@@ -142,9 +247,16 @@ self.addEventListener("fetch", (event) => {
142
247
  return;
143
248
  }
144
249
 
250
+ // Forward the root (e.g. the app's start) right away, also offline, instead
251
+ // of loading its forwarding page (_layouts/editions.html)
252
+ if (request.mode === "navigate" && url.pathname === `${BASE_URL}/` && url.pathname !== EDITION_URL) {
253
+ event.respondWith(Response.redirect(`${EDITION_URL}${url.search}`));
254
+ return;
255
+ }
256
+
145
257
  // Example: /program/ (navigation) and /assets/js/data.json change during the conference
146
258
  if (request.mode === "navigate" || url.pathname.endsWith(".json")) {
147
- event.respondWith(networkFirst(event));
259
+ event.respondWith(staleWhileRevalidate(event));
148
260
  return;
149
261
  }
150
262
 
data/_sass/bootstrap.scss CHANGED
@@ -40,6 +40,7 @@
40
40
  @import "bootstrap/scss/navbar";
41
41
  @import "bootstrap/scss/offcanvas";
42
42
  @import "bootstrap/scss/tables";
43
+ @import "bootstrap/scss/toasts";
43
44
  @import "bootstrap/scss/transitions";
44
45
 
45
46
  // Include utilities API last to generate classes based on the Sass map in `_utilities.scss`