jekyll-theme-zer0 1.31.2 → 1.32.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 (82) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +183 -0
  3. data/_data/ai.yml +1 -1
  4. data/_data/backlog.yml +149 -28
  5. data/_data/features.yml +173 -17
  6. data/_data/navigation/admin.yml +26 -8
  7. data/_data/navigation/docs.yml +2 -8
  8. data/_data/site_builder.yml +1 -1
  9. data/_data/theme-manifest.yml +74 -58
  10. data/_data/ui-text.yml +9 -0
  11. data/_includes/README.md +2 -1
  12. data/_includes/analytics/google-analytics.html +46 -9
  13. data/_includes/analytics/posthog.html +101 -77
  14. data/_includes/components/ai-chat.html +3 -3
  15. data/_includes/components/author-bio.html +3 -1
  16. data/_includes/components/author-card.html +9 -9
  17. data/_includes/components/author-eeat.html +13 -3
  18. data/_includes/components/collection-manager.html +2 -2
  19. data/_includes/components/component-showcase.html +7 -7
  20. data/_includes/components/cookie-consent-needed.html +37 -0
  21. data/_includes/components/cookie-consent.html +44 -5
  22. data/_includes/components/page-feedback.html +10 -6
  23. data/_includes/components/post-card.html +2 -2
  24. data/_includes/components/theme-customizer.html +1 -1
  25. data/_includes/content/comments.html +46 -0
  26. data/_includes/content/giscus.html +22 -13
  27. data/_includes/content/intro.html +39 -3
  28. data/_includes/content/jsonld-software.html +4 -9
  29. data/_includes/content/sitemap.html +173 -17
  30. data/_includes/core/favicon.html +42 -6
  31. data/_includes/core/footer.html +38 -17
  32. data/_includes/core/header.html +11 -2
  33. data/_includes/navigation/admin-nav.html +110 -63
  34. data/_includes/navigation/section-sidebar.html +20 -20
  35. data/_includes/navigation/sidebar-config.html +17 -8
  36. data/_includes/navigation/sidebar-right.html +16 -2
  37. data/_includes/setup/wizard.html +2 -2
  38. data/_layouts/README.md +1 -1
  39. data/_layouts/admin.html +49 -20
  40. data/_layouts/article.html +10 -10
  41. data/_layouts/book-story.html +3 -7
  42. data/_layouts/default.html +63 -2
  43. data/_layouts/news.html +8 -7
  44. data/_layouts/note.html +2 -6
  45. data/_layouts/notebook.html +2 -6
  46. data/_layouts/recipe.html +3 -7
  47. data/_layouts/root.html +7 -4
  48. data/_layouts/section.html +43 -42
  49. data/_sass/components/_back-to-top.scss +9 -0
  50. data/_sass/components/_cookie-banner.scss +31 -0
  51. data/_sass/components/_page-feedback.scss +1 -1
  52. data/_sass/components/_ui-enhancements.scss +22 -0
  53. data/_sass/core/_nav-tree.scss +10 -2
  54. data/_sass/core/_navbar.scss +19 -5
  55. data/_sass/core/_obsidian.scss +19 -3
  56. data/_sass/core/_sidebar-categories.scss +4 -2
  57. data/_sass/core/_sidebar-extras.scss +3 -2
  58. data/_sass/layouts/_admin.scss +60 -0
  59. data/_sass/layouts/_navbar-extras.scss +7 -2
  60. data/_sass/theme/_skins.scss +124 -32
  61. data/_sass/tokens/_color.scss +3 -0
  62. data/_sass/tokens/_layers.scss +12 -5
  63. data/_sass/utilities/_focus.scss +12 -1
  64. data/assets/css/main.scss +1 -0
  65. data/assets/js/code-copy.js +30 -2
  66. data/assets/js/modules/navigation/index.js +94 -40
  67. data/assets/js/modules/navigation/scroll-spy.js +70 -7
  68. data/assets/js/setup-wizard.js +2 -2
  69. data/assets/js/ui-enhancements.js +46 -0
  70. data/scripts/ai/README.md +1 -1
  71. data/scripts/ai/api_call.rb +1 -1
  72. data/scripts/bin/audit-consumer +155 -8
  73. data/scripts/bin/manifest +27 -8
  74. data/scripts/bin/validate +3 -2
  75. data/scripts/ci/test_visual_evidence_autogen.py +53 -1
  76. data/scripts/ci/visual_evidence_autogen.py +26 -7
  77. data/scripts/install/ai/client.sh +1 -1
  78. data/scripts/lib/audit.sh +156 -0
  79. data/scripts/lib/preview_generator.py +1 -1
  80. data/scripts/translate.rb +1 -1
  81. data/scripts/validate-features.rb +20 -2
  82. metadata +5 -2
@@ -0,0 +1,46 @@
1
+ {%- comment -%} Feature: ZER0-035 {%- endcomment -%}
2
+ {%- comment -%}
3
+ Component: comments
4
+ Path: _includes/content/comments.html
5
+ Purpose: A page's comment section in one include: the gate, the
6
+ "Comments" heading and the giscus widget (content/giscus.html).
7
+ The article, note, notebook, recipe and book-story layouts all
8
+ render comments through it, so a consumer layout needs one
9
+ include line to show comments the way the theme does.
10
+ Params: default_on (bool, optional, default: true)
11
+ true — shown unless the page sets `comments: false`
12
+ false — shown only when the page sets `comments: true`
13
+ class (string, optional, default: "post-comments")
14
+ the wrapper's own class; the spacing utilities are added
15
+ compact (bool, optional, default: false)
16
+ a div with an h5 heading and no id, the style of the note
17
+ and notebook footer sections; the default is a
18
+ section#comments with an h2 heading
19
+ Depends on: content/giscus.html, site.giscus.enabled, page.comments
20
+ Notes: Renders nothing unless `site.giscus.enabled` is true.
21
+ article, note and notebook keep the default (on unless a page
22
+ opts out); recipe and book-story pass default_on=false (off
23
+ unless a page opts in). The giscus attributes (theme, mapping,
24
+ input position, language) come from the `giscus:` block in
25
+ _config.yml; see content/giscus.html.
26
+ {%- endcomment -%}
27
+ {%- assign _comments_on = false -%}
28
+ {%- if include.default_on == false -%}
29
+ {%- if page.comments -%}{%- assign _comments_on = true -%}{%- endif -%}
30
+ {%- elsif page.comments != false -%}
31
+ {%- assign _comments_on = true -%}
32
+ {%- endif -%}
33
+ {%- if _comments_on and site.giscus.enabled -%}
34
+ {%- assign _comments_class = include.class | default: 'post-comments' -%}
35
+ {%- if include.compact %}
36
+ <div class="{{ _comments_class }} mt-5 pt-4 border-top">
37
+ <h5 class="mb-4">Comments</h5>
38
+ {% include content/giscus.html %}
39
+ </div>
40
+ {%- else %}
41
+ <section class="{{ _comments_class }} mt-5 pt-4 border-top" id="comments">
42
+ <h2 class="h4 mb-4"><i class="bi bi-chat-dots me-2" aria-hidden="true"></i>Comments</h2>
43
+ {% include content/giscus.html %}
44
+ </section>
45
+ {%- endif -%}
46
+ {%- endif -%}
@@ -6,23 +6,32 @@
6
6
  Purpose: Embeds the Giscus widget so page comments are stored as
7
7
  GitHub Discussions (no database, privacy-friendly).
8
8
  Location: _includes/content/giscus.html
9
- Usage: Rendered by the article / note / notebook layouts, gated on
10
- `page.comments != false and site.giscus.enabled`.
11
- To include manually elsewhere, use the FULL path:
9
+ Usage: Rendered by content/comments.html, which owns the gate
10
+ (`page.comments` and `site.giscus.enabled`), the heading and
11
+ the section for the article / note / notebook / recipe /
12
+ book-story layouts. A layout that wants comments includes
13
+ content/comments.html, not this file. To embed the bare
14
+ widget elsewhere, use the FULL path:
12
15
  include content/giscus.html (wrap in Liquid tags)
13
16
  Dependencies: site.repository, site.giscus.* (see _config.yml), a public
14
17
  repo with Discussions enabled + the Giscus app installed.
15
18
 
16
19
  Features:
17
20
  • GitHub Discussions-based commenting
18
- • Automatic light/dark theme (preferred_color_scheme)
19
- • Pathname-based mapping for one thread per page (data-strict)
20
- • Reactions enabled, input positioned at the top
21
+ • Strict title matching for one thread per page (data-strict)
22
+ • Reactions enabled
21
23
 
22
24
  Config-driven attributes (from _config.yml `giscus:` block):
23
- • data-repo ← site.repository
24
- • data-repo-id ← site.giscus.data-repo-id
25
- • data-category-id ← site.giscus.data-category-id
25
+ • data-repo ← site.repository
26
+ • data-repo-id ← site.giscus.data-repo-id
27
+ • data-category-id ← site.giscus.data-category-id
28
+ • data-mapping ← site.giscus.data-mapping (default: pathname)
29
+ • data-input-position ← site.giscus.data-input-position (default: top)
30
+ • data-theme ← site.giscus.data-theme (default: preferred_color_scheme)
31
+ • data-lang ← site.giscus.data-lang (default: en)
32
+ The last four are optional: an unset or blank key keeps the default, so a
33
+ site that sets none of them renders exactly the tag it rendered before
34
+ they existed. Values are passed to giscus as given (HTML-escaped).
26
35
 
27
36
  Docs: pages/_docs/features/giscus-comments.md
28
37
  Reference: https://giscus.app/ (Feature Request #FR000001)
@@ -36,13 +45,13 @@
36
45
  data-repo="{{ site.repository }}"
37
46
  data-repo-id="{{ site.giscus.data-repo-id }}"
38
47
  data-category-id="{{ site.giscus.data-category-id }}"
39
- data-mapping="pathname"
48
+ data-mapping="{{ site.giscus.data-mapping | default: 'pathname' | escape }}"
40
49
  data-strict="1"
41
50
  data-reactions-enabled="1"
42
51
  data-emit-metadata="0"
43
- data-input-position="top"
44
- data-theme="preferred_color_scheme"
45
- data-lang="en"
52
+ data-input-position="{{ site.giscus.data-input-position | default: 'top' | escape }}"
53
+ data-theme="{{ site.giscus.data-theme | default: 'preferred_color_scheme' | escape }}"
54
+ data-lang="{{ site.giscus.data-lang | default: 'en' | escape }}"
46
55
  crossorigin="anonymous"
47
56
  async>
48
57
  </script>
@@ -111,6 +111,20 @@
111
111
  {% endif %}
112
112
  {% endif %}
113
113
 
114
+ {% comment %} Tags index existence gate (issue #537) — the same policy as
115
+ news.html / section.html: an explicit site.tags_page is trusted; otherwise
116
+ link only when a page at /tags/ is actually in the build. A remote-theme
117
+ consumer without the tags index gets plain badges instead of 404 links on
118
+ every tagged page. {% endcomment %}
119
+ {% assign intro_tags_base = site.tags_page | default: "/tags/" %}
120
+ {% assign intro_tags_linkable = false %}
121
+ {% if site.tags_page %}
122
+ {% assign intro_tags_linkable = true %}
123
+ {% else %}
124
+ {% assign intro_tags_index = site.html_pages | where: "url", intro_tags_base | first %}
125
+ {% if intro_tags_index %}{% assign intro_tags_linkable = true %}{% endif %}
126
+ {% endif %}
127
+
114
128
  {% comment %} Category or collection badge (most specific category wins) {% endcomment %}
115
129
  {% assign intro_category = nil %}
116
130
  {% assign intro_category_url = nil %}
@@ -125,11 +139,29 @@
125
139
  {% endfor %}
126
140
  {% endif %}
127
141
  {% if page.categories contains "docs" %}
142
+ {% comment %} Docs section badge (issue #486). A page whose only category is
143
+ "docs" used to link /docs/docs/, and a category with no section index
144
+ (e.g. "setup") linked a 404. The section root is /docs/ itself, and any
145
+ other section is linked only when a page or doc at that URL is in the
146
+ build; otherwise the badge renders as plain text. {% endcomment %}
128
147
  {% assign intro_category_slug = intro_category | append: '' | slugify %}
129
- {% capture intro_category_url %}{{ site.baseurl }}/docs/{{ intro_category_slug }}/{% endcapture %}
148
+ {% if intro_category_slug == "docs" %}
149
+ {% assign intro_docs_section = "/docs/" %}
150
+ {% else %}
151
+ {% assign intro_docs_section = "/docs/" | append: intro_category_slug | append: "/" %}
152
+ {% endif %}
153
+ {% assign intro_docs_index = site.docs | where: "url", intro_docs_section | first %}
154
+ {% unless intro_docs_index %}
155
+ {% assign intro_docs_index = site.html_pages | where: "url", intro_docs_section | first %}
156
+ {% endunless %}
157
+ {% if intro_docs_index %}
158
+ {% capture intro_category_url %}{{ site.baseurl }}{{ intro_docs_section }}{% endcapture %}
159
+ {% endif %}
130
160
  {% else %}
131
161
  {% assign intro_category_slug = intro_category | append: '' | slugify %}
132
- {% capture intro_category_url %}{{ '/tags/' | relative_url }}#{{ intro_category_slug }}{% endcapture %}
162
+ {% if intro_tags_linkable %}
163
+ {% capture intro_category_url %}{{ intro_tags_base | relative_url }}#{{ intro_category_slug }}{% endcapture %}
164
+ {% endif %}
133
165
  {% endif %}
134
166
  {% elsif page.collection and page.collection != "pages" %}
135
167
  {% assign intro_category = page.collection %}
@@ -217,7 +249,11 @@
217
249
  <span class="bd-intro-tag-list">
218
250
  {% for tag in page.tags limit: 5 %}
219
251
  {% assign intro_tag_label = tag | append: '' %}
220
- <a class="bd-intro-badge bd-intro-badge--tag" href="{{ '/tags/' | relative_url }}#{{ intro_tag_label | slugify }}">{{ intro_tag_label }}</a>
252
+ {% if intro_tags_linkable %}
253
+ <a class="bd-intro-badge bd-intro-badge--tag" href="{{ intro_tags_base | relative_url }}#{{ intro_tag_label | slugify }}">{{ intro_tag_label }}</a>
254
+ {% else %}
255
+ <span class="bd-intro-badge bd-intro-badge--tag">{{ intro_tag_label }}</span>
256
+ {% endif %}
221
257
  {% endfor %}
222
258
  {% if page.tags.size > 5 %}
223
259
  <span class="bd-intro-badge bd-intro-badge--tag bd-intro-badge--more">+{{ page.tags.size | minus: 5 }}</span>
@@ -124,15 +124,10 @@
124
124
  {
125
125
  "@type": "Person",
126
126
  "@id": "{{ site.url }}/#author",
127
- "name": "{{ site.founder | default: 'Amr Abdel-Motaleb' }}",
128
- "alternateName": "bamr87",
129
- "url": "https://github.com/bamr87",
130
- "sameAs": [
131
- "https://github.com/bamr87",
132
- "https://x.com/bamr87"
133
- ],
134
- "jobTitle": "Software Developer",
135
- "knowsAbout": ["Jekyll", "Docker", "Bootstrap", "GitHub Pages", "Static Site Generation"]
127
+ "name": "{{ site.founder | default: site.author.name | default: site.title }}"{% if site.github_user %},
128
+ "alternateName": "{{ site.github_user }}",
129
+ "url": "https://github.com/{{ site.github_user }}",
130
+ "sameAs": ["https://github.com/{{ site.github_user }}"]{% endif %}
136
131
  }
137
132
  ]
138
133
  }
@@ -211,11 +211,20 @@
211
211
  <tbody id="sitemapTableBody">
212
212
  {% assign total_pages = 0 %}
213
213
  {% assign collections_data = '' %}
214
+ {% comment %}
215
+ Only the first page of rows is rendered as HTML, which is enough
216
+ for no-JS visitors and first paint. Every row (these included) is
217
+ also in the compact #sitemapData JSON below, and the script builds
218
+ the other rows from it when they are needed. With 431 rows on
219
+ it-journey.dev, rendering them all made /search/ 2.2 MB of HTML.
220
+ {% endcomment %}
221
+ {% assign sitemap_server_rows = 50 %}
214
222
 
215
223
  {% comment %}Loose Jekyll pages (site.pages in Liquid is the "pages" collection, not these files){% endcomment %}
216
224
  {% for page in site.html_pages %}
217
225
  {% unless page.sitemap == false %}
218
226
  {% assign total_pages = total_pages | plus: 1 %}
227
+ {% if total_pages <= sitemap_server_rows %}
219
228
  <tr data-collection="pages"
220
229
  data-title="{{ page.title | default: page.name | escape }}"
221
230
  data-description="{{ page.description | escape }}"
@@ -281,6 +290,7 @@
281
290
  </div>
282
291
  </td>
283
292
  </tr>
293
+ {% endif %}
284
294
  {% endunless %}
285
295
  {% endfor %}
286
296
 
@@ -289,6 +299,7 @@
289
299
  {% for item in collection.docs %}
290
300
  {% unless item.sitemap == false %}
291
301
  {% assign total_pages = total_pages | plus: 1 %}
302
+ {% if total_pages <= sitemap_server_rows %}
292
303
  <tr data-collection="{{ collection.label }}"
293
304
  data-title="{{ item.title | escape }}"
294
305
  data-description="{{ item.description | escape }}"
@@ -354,6 +365,7 @@
354
365
  </div>
355
366
  </td>
356
367
  </tr>
368
+ {% endif %}
357
369
  {% endunless %}
358
370
  {% endfor %}
359
371
  {% endfor %}
@@ -365,6 +377,43 @@
365
377
  </div>
366
378
  </div>
367
379
 
380
+ {% comment %}
381
+ Row data for the whole index, one compact entry per row in the same order
382
+ as the loops above. Keys: c collection, cl collection label, t title,
383
+ d description, x description cell text (description or excerpt),
384
+ cat/tag arrays, dt ISO date, dl display date, u url. "</" is escaped so
385
+ a title can't close the script element early.
386
+ {% endcomment %}
387
+ {%- capture sitemap_json -%}
388
+ [
389
+ {%- assign sm_first = true -%}
390
+ {%- for page in site.html_pages -%}
391
+ {%- unless page.sitemap == false -%}
392
+ {%- unless sm_first %},{% endunless -%}{%- assign sm_first = false -%}
393
+ {"c":"pages","cl":"Pages","t":{{ page.title | default: page.name | jsonify }},"d":{{ page.description | default: "" | jsonify }},"x":{{ page.description | default: "No description available" | jsonify }},"cat":{{ page.categories | default: empty | jsonify }},"tag":{{ page.tags | default: empty | jsonify }},"dt":{{ page.lastmod | default: page.date | date: '%Y-%m-%d' | jsonify }},"dl":{{ page.lastmod | default: page.date | date: "%b %d, %Y" | default: "Unknown" | jsonify }},"u":{{ page.url | relative_url | jsonify }}}
394
+ {%- endunless -%}
395
+ {%- endfor -%}
396
+ {%- for collection in site.collections -%}
397
+ {%- assign sm_label = collection.label | capitalize -%}
398
+ {%- for item in collection.docs -%}
399
+ {%- unless item.sitemap == false -%}
400
+ {%- unless sm_first %},{% endunless -%}{%- assign sm_first = false -%}
401
+ {"c":{{ collection.label | jsonify }},"cl":{{ sm_label | jsonify }},"t":{{ item.title | default: "" | jsonify }},"d":{{ item.description | default: "" | jsonify }},"x":{{ item.description | default: item.excerpt | strip_html | default: "No description available" | jsonify }},"cat":{{ item.categories | default: empty | jsonify }},"tag":{{ item.tags | default: empty | jsonify }},"dt":{{ item.lastmod | default: item.date | date: '%Y-%m-%d' | jsonify }},"dl":{{ item.lastmod | default: item.date | date: "%b %d, %Y" | default: "Unknown" | jsonify }},"u":{{ item.url | relative_url | jsonify }}}
402
+ {%- endunless -%}
403
+ {%- endfor -%}
404
+ {%- endfor -%}
405
+ ]
406
+ {%- endcapture -%}
407
+ <script type="application/json" id="sitemapData" data-site-url="{{ site.url }}" data-server-rows="{{ sitemap_server_rows }}">{{ sitemap_json | replace: "</", "<\/" }}</script>
408
+ {%- if total_pages > sitemap_server_rows %}
409
+ <noscript>
410
+ <p class="text-center text-muted mt-3">
411
+ Showing the first {{ sitemap_server_rows }} of {{ total_pages }} pages. Turn on JavaScript to search and page through all of them
412
+ {%- if site.plugins contains 'jekyll-sitemap' or site.gems contains 'jekyll-sitemap' %}, or browse the full list in the <a href="{{ '/sitemap.xml' | relative_url }}">XML sitemap</a>{% endif %}.
413
+ </p>
414
+ </noscript>
415
+ {%- endif %}
416
+
368
417
  {% comment %} ================================ {% endcomment %}
369
418
  {% comment %} CARDS VIEW CONTAINER {% endcomment %}
370
419
  {% comment %} ================================ {% endcomment %}
@@ -474,13 +523,17 @@ th:hover .sort-icon {
474
523
  * Enhanced Sitemap Functionality
475
524
  * Features: Advanced search, sorting, filtering, statistics, and card/table views
476
525
  *
477
- * Paginated: every row is still rendered server-side (so the index works
478
- * without JS and with ?q= from the search modal's "View all results"), but
479
- * only PAGE_SIZE matching rows stay in the document; the rest are kept in
480
- * memory and a "Show more" button appends the next page. Cards are built on
481
- * the first switch to card view, one page at a time. On it-journey.dev the
482
- * index (431 rows plus 431 eagerly built cards) put ~19,900 elements on
483
- * /search/ before the visitor typed anything.
526
+ * Paginated: only PAGE_SIZE matching rows are in the document at a time,
527
+ * and a "Show more" button appends the next page. Cards are built on the
528
+ * first switch to card view, one page at a time.
529
+ *
530
+ * Only the first page of rows is rendered server-side, which is enough for
531
+ * no-JS visitors and first paint. Every row is described by a compact entry
532
+ * in #sitemapData, and this script builds the other <tr> elements from it
533
+ * the first time they are shown or sorted. Search and filters run on the
534
+ * entries, so ?q= from the search modal's "View all results" still covers
535
+ * the whole index. On it-journey.dev the full server-rendered table (431
536
+ * rows) made /search/ about 2.2 MB of HTML.
484
537
  */
485
538
  class SitemapManager {
486
539
  static PAGE_SIZE = 50;
@@ -503,7 +556,22 @@ class SitemapManager {
503
556
  this.showMoreWrap = document.getElementById('sitemapShowMore');
504
557
  this.showMoreBtn = document.getElementById('sitemapShowMoreBtn');
505
558
 
506
- this.rows = Array.from(this.tbody.querySelectorAll('tr'));
559
+ // One entry per index row. `dataset` mirrors the <tr data-*> attributes
560
+ // so search, filters, stats and cards read entries and rows alike.
561
+ // The first rows reuse the server-rendered <tr>; the rest are built
562
+ // on demand by rowFor().
563
+ const serverRows = Array.from(this.tbody.querySelectorAll('tr'));
564
+ const dataEl = document.getElementById('sitemapData');
565
+ let data = [];
566
+ try {
567
+ data = dataEl ? JSON.parse(dataEl.textContent) : [];
568
+ } catch (error) {
569
+ console.warn('Sitemap: could not read #sitemapData', error);
570
+ }
571
+ this.siteUrl = dataEl ? (dataEl.dataset.siteUrl || '') : '';
572
+ this.rows = data.length
573
+ ? data.map((e, i) => this.entryFrom(e, serverRows[i] || null))
574
+ : serverRows.map(tr => ({ dataset: tr.dataset, row: tr }));
507
575
  this.visibleCount = document.getElementById('visibleCount');
508
576
  this.totalCount = document.getElementById('totalCount');
509
577
 
@@ -517,6 +585,91 @@ class SitemapManager {
517
585
  this.init();
518
586
  }
519
587
 
588
+ // Normalise one #sitemapData entry; `row` is its server-rendered <tr>, if any.
589
+ entryFrom(e, row) {
590
+ const list = v => Array.isArray(v) ? v.map(String) : (v ? [String(v)] : []);
591
+ const categories = list(e.cat);
592
+ const tags = list(e.tag);
593
+ return {
594
+ row,
595
+ raw: e,
596
+ categoriesList: categories,
597
+ tagsList: tags,
598
+ dataset: {
599
+ collection: e.c || '',
600
+ title: e.t || '',
601
+ description: e.d || '',
602
+ categories: categories.join(', '),
603
+ tags: tags.join(', '),
604
+ date: e.dt || '',
605
+ url: e.u || ''
606
+ }
607
+ };
608
+ }
609
+
610
+ // Liquid's `truncate`: at most n characters including the "..." suffix.
611
+ static truncate(text, n) {
612
+ const chars = Array.from(text || '');
613
+ return chars.length > n ? chars.slice(0, n - 3).join('') + '...' : chars.join('');
614
+ }
615
+
616
+ // The <tr> for an entry: the server-rendered one, or built once with
617
+ // the same markup the include renders (text set via textContent).
618
+ rowFor(entry) {
619
+ if (entry.row) return entry.row;
620
+ const e = entry.raw;
621
+ const d = entry.dataset;
622
+ const tr = document.createElement('tr');
623
+ Object.entries(d).forEach(([k, v]) => { tr.dataset[k] = v; });
624
+ const isPage = d.collection === 'pages';
625
+ tr.innerHTML = `
626
+ <td><span class="badge ${isPage ? 'text-bg-primary' : 'text-bg-info'} rounded-pill"></span></td>
627
+ <td><a class="text-decoration-none fw-medium"></a></td>
628
+ <td class="d-none d-md-table-cell"><small class="text-muted"></small></td>
629
+ <td><small class="text-muted"></small></td>
630
+ <td class="d-none d-lg-table-cell"></td>
631
+ <td class="d-none d-xl-table-cell"></td>
632
+ <td class="text-center">
633
+ <div class="btn-group btn-group-sm" role="group">
634
+ <a class="btn btn-outline-primary btn-sm" title="View page"><i class="bi bi-eye"></i></a>
635
+ <button class="btn btn-outline-secondary btn-sm copy-url" title="Copy URL"><i class="bi bi-clipboard"></i></button>
636
+ </div>
637
+ </td>`;
638
+ const cells = tr.children;
639
+ cells[0].firstElementChild.textContent = e.cl || d.collection;
640
+ const link = cells[1].firstElementChild;
641
+ link.href = d.url;
642
+ link.textContent = SitemapManager.truncate(d.title, 50);
643
+ if (d.description) {
644
+ const small = document.createElement('small');
645
+ small.className = 'text-muted d-md-none';
646
+ small.textContent = SitemapManager.truncate(d.description, 80);
647
+ cells[1].append(document.createElement('br'), small);
648
+ }
649
+ cells[2].firstElementChild.textContent = SitemapManager.truncate(e.x || 'No description available', 120);
650
+ cells[3].firstElementChild.textContent = e.dl || 'Unknown';
651
+ const chips = (cell, items, max, cls, prefix) => {
652
+ items.slice(0, max).forEach(item => {
653
+ const b = document.createElement('span');
654
+ b.className = `badge ${cls} me-1`;
655
+ b.textContent = prefix + item;
656
+ cell.append(b, ' ');
657
+ });
658
+ if (items.length > max) {
659
+ const more = document.createElement('span');
660
+ more.className = 'badge text-body-secondary border';
661
+ more.textContent = `+${items.length - max}`;
662
+ cell.append(more);
663
+ }
664
+ };
665
+ chips(cells[4], entry.categoriesList, 2, 'bg-secondary', '');
666
+ chips(cells[5], entry.tagsList, 3, 'bg-outline-primary', '#');
667
+ cells[6].querySelector('a').href = d.url;
668
+ cells[6].querySelector('.copy-url').dataset.url = this.siteUrl + d.url;
669
+ entry.row = tr;
670
+ return tr;
671
+ }
672
+
520
673
  init() {
521
674
  this.setupCollectionFilter();
522
675
  this.updateStatistics();
@@ -651,11 +804,11 @@ class SitemapManager {
651
804
  header.addEventListener('click', () => this.sortTable(header));
652
805
  });
653
806
 
654
- // Copy URL functionality (table rows; cards bind their own)
655
- this.rows.forEach(row => {
656
- row.querySelectorAll('.copy-url').forEach(btn => {
657
- btn.addEventListener('click', (e) => this.copyUrl(e));
658
- });
807
+ // Copy URL functionality (table rows, delegated so rows built later
808
+ // work too; cards bind their own)
809
+ this.tbody.addEventListener('click', (e) => {
810
+ const btn = e.target.closest('.copy-url');
811
+ if (btn && this.tbody.contains(btn)) this.copyUrl({ currentTarget: btn });
659
812
  });
660
813
 
661
814
  // Keyboard shortcuts
@@ -729,7 +882,7 @@ class SitemapManager {
729
882
  render() {
730
883
  const shown = this.matches.slice(0, this.limit);
731
884
  if (this.currentView === 'table') {
732
- this.tbody.replaceChildren(...shown);
885
+ this.tbody.replaceChildren(...shown.map(entry => this.rowFor(entry)));
733
886
  } else {
734
887
  this.cardsContainer.replaceChildren(...shown.map(row => this.cardFor(row)));
735
888
  }
@@ -760,10 +913,13 @@ class SitemapManager {
760
913
  const icon = header.querySelector('.sort-icon');
761
914
  icon.className = `sort-icon bi bi-arrow-${newOrder === 'asc' ? 'up' : 'down'} ms-1 active`;
762
915
 
763
- // Sort every row (not just the rendered page), then re-render
916
+ // Sort every row (not just the rendered page), then re-render. Keys
917
+ // come from each row's cell text, so rows not built yet are built
918
+ // here (once, on the visitor's click).
919
+ const keys = new Map(this.rows.map(entry => [entry, this.rowFor(entry).children[headerIndex].textContent.trim()]));
764
920
  this.rows.sort((a, b) => {
765
- let aValue = a.children[headerIndex].textContent.trim();
766
- let bValue = b.children[headerIndex].textContent.trim();
921
+ let aValue = keys.get(a);
922
+ let bValue = keys.get(b);
767
923
 
768
924
  if (type === 'date') {
769
925
  aValue = aValue === "Unknown" ? new Date(0) : new Date(aValue);
@@ -10,7 +10,7 @@
10
10
  Params: none — reads the optional `favicon:` block in _config.yml:
11
11
 
12
12
  favicon:
13
- ico : /favicon.ico # legacy .ico (default)
13
+ ico : /favicon.ico # legacy .ico (always emitted when set)
14
14
  svg : /assets/images/favicon.svg # scalable icon (optional)
15
15
  png : /assets/images/favicon-32.png # PNG icon (optional)
16
16
  png_size : 32x32 # sizes attr for png (optional)
@@ -20,9 +20,13 @@
20
20
  theme_color_light : "#ffffff" # light-scheme chrome (optional)
21
21
  theme_color_dark : "#212529" # dark-scheme chrome (optional)
22
22
 
23
- With NO config at all this still emits the explicit
24
- /favicon.ico link (every consumer site carries one at root)
25
- AND both theme-color tags. That last part is the point of the
23
+ With NO `favicon.ico` configured, the default icon link is
24
+ emitted only for a root icon file that actually exists in
25
+ site.static_files: /favicon.ico, else /favicon.png, else
26
+ /favicon.svg — and nothing at all when none exists. A
27
+ remote_theme consumer does not get this repo's favicon.ico, so
28
+ an unconditional /favicon.ico link 404'd on every page of such
29
+ sites (issue #536). Both theme-color tags are always emitted. That last part is the point of the
26
30
  fallbacks below: a remote_theme consumer does not inherit this
27
31
  repo's _config.yml (see remote-theme-checklist.md), so a
28
32
  config-gated tag emitted nothing at all on exactly the sites
@@ -31,8 +35,40 @@
31
35
  run through relative_url so baseurl deployments resolve.
32
36
  {%- endcomment -%}
33
37
  {%- assign _fav = site.favicon -%}
34
- {%- assign _fav_ico = _fav.ico | default: '/favicon.ico' -%}
35
- <link rel="icon" href="{{ _fav_ico | relative_url }}" sizes="32x32">
38
+ {%- comment -%}
39
+ Default icon (issue #536). A configured `favicon.ico` is trusted as-is.
40
+ Otherwise probe site.static_files (each entry's `path` is source-relative,
41
+ e.g. "/favicon.ico") for a root icon, in order .ico -> .png -> .svg, and
42
+ emit a link only for one that exists. The .png/.svg fallbacks are skipped
43
+ when the same kind is already configured via favicon.png / favicon.svg, so
44
+ the page never carries two links of one type.
45
+ {%- endcomment -%}
46
+ {%- assign _fav_default = '' -%}
47
+ {%- assign _fav_default_type = '' -%}
48
+ {%- if _fav.ico -%}
49
+ {%- assign _fav_default = _fav.ico -%}
50
+ {%- else -%}
51
+ {%- assign _fav_hit = site.static_files | where: "path", "/favicon.ico" | first -%}
52
+ {%- if _fav_hit -%}
53
+ {%- assign _fav_default = '/favicon.ico' -%}
54
+ {%- elsif _fav.png == nil -%}
55
+ {%- assign _fav_hit = site.static_files | where: "path", "/favicon.png" | first -%}
56
+ {%- if _fav_hit -%}
57
+ {%- assign _fav_default = '/favicon.png' -%}
58
+ {%- assign _fav_default_type = 'image/png' -%}
59
+ {%- endif -%}
60
+ {%- endif -%}
61
+ {%- if _fav_default == '' and _fav.svg == nil -%}
62
+ {%- assign _fav_hit = site.static_files | where: "path", "/favicon.svg" | first -%}
63
+ {%- if _fav_hit -%}
64
+ {%- assign _fav_default = '/favicon.svg' -%}
65
+ {%- assign _fav_default_type = 'image/svg+xml' -%}
66
+ {%- endif -%}
67
+ {%- endif -%}
68
+ {%- endif -%}
69
+ {%- if _fav_default != '' %}
70
+ <link rel="icon"{% if _fav_default_type != '' %} type="{{ _fav_default_type }}"{% endif %} href="{{ _fav_default | relative_url }}"{% if _fav_default_type == '' %} sizes="32x32"{% endif %}>
71
+ {%- endif %}
36
72
  {%- if _fav.svg %}
37
73
  <link rel="icon" type="image/svg+xml" href="{{ _fav.svg | relative_url }}">
38
74
  {%- endif %}
@@ -7,20 +7,25 @@
7
7
  File: footer.html
8
8
  Path: _includes/footer.html
9
9
  Purpose: Rich footer inspired by bashconsultants with Powered-by row,
10
- branding/contact, quick links, social/RSS, subscribe form, and
11
- policy links. Fully responsive with Bootstrap 5 utilities.
10
+ branding/contact, quick links, social/RSS, an opt-in newsletter
11
+ signup, and policy links. Fully responsive with Bootstrap 5 utilities.
12
12
 
13
13
  Template Logic:
14
14
  - Top row: "Powered by" credits from site.powered_by
15
15
  - Branding block: Site title, optional address/phone/email
16
16
  - Quick links: Common pages (adjust as needed)
17
17
  - Social links: site.links with icons + RSS feed
18
- - Subscribe form: Non-functional placeholder endpoint (/subscribe)
18
+ - Newsletter signup: only when a provider endpoint is configured
19
+ (site.newsletter, else site.news.newsletter); the form POSTs the email
20
+ to that endpoint. With none, no form renders and the policy links
21
+ take the whole row
19
22
  - Bottom bar: Dynamic copyright year
20
23
 
21
24
  Dependencies:
22
25
  - site.powered_by: Framework and service credits
23
26
  - site.links: Social media and affiliate links
27
+ - site.newsletter: Newsletter provider (enabled, endpoint, method,
28
+ email_field); falls back to site.news.newsletter
24
29
  - site.default_icon: Icon framework (Bootstrap Icons)
25
30
  - core/i18n.html: UI strings (per-page language via the `lang` param)
26
31
  - Bootstrap 5 classes provided by the theme
@@ -40,9 +45,8 @@
40
45
  {% assign footer_page_urls = site.html_pages | map: "url" | join: "|" | prepend: "|" | append: "|" %}
41
46
  {% comment %} Powered by Row {% endcomment %}
42
47
  <div class="container-xl footer-powered-by">
43
- <p class="footer-powered-by-copyright text-center mb-0">
44
- &copy; {{ site.time | date: "%Y" }} {{ site.name | default: site.title }}
45
- </p>
48
+ {%- comment -%} The copyright line lives once, in the bottom bar below.
49
+ A second "© year name" line here printed the notice twice (backlog T-054). {%- endcomment -%}
46
50
  <div class="footer-powered-by-row">
47
51
  <span class="footer-powered-by-label" id="footer-powered-by-label">
48
52
  {{ ui.powered_by | default: "Powered by" }}:
@@ -224,25 +228,38 @@
224
228
  </div>
225
229
  </div>
226
230
 
227
- {% comment %} Middle: Subscribe + Policies {% endcomment %}
231
+ {%- comment -%}
232
+ Middle: newsletter signup + policies. The signup renders only when it
233
+ can work (#554): a provider endpoint from the top-level `newsletter:`
234
+ block, falling back to `news.newsletter:` (the news band's block in
235
+ _layouts/news.html), so one provider lights up both. `enabled: false`
236
+ hides it. A blank endpoint counts as unset, because '' is truthy in
237
+ Liquid. There is deliberately no mailto: fallback here. Without a
238
+ form, the policy links take the whole row.
239
+ {%- endcomment -%}
240
+ {%- assign _footer_nl = site.newsletter | default: site.news.newsletter -%}
241
+ {%- assign _footer_nl_endpoint = _footer_nl.endpoint | strip -%}
242
+ {%- assign _footer_nl_on = false -%}
243
+ {%- assign _footer_policy_cols = "col-12 text-center" -%}
244
+ {%- if _footer_nl_endpoint != "" and _footer_nl.enabled != false -%}
245
+ {%- assign _footer_nl_on = true -%}
246
+ {%- assign _footer_policy_cols = "col-12 col-md-4 col-lg-4 text-md-end text-lg-end" -%}
247
+ {%- endif -%}
228
248
  <div class="row mb-3 mb-lg-4 align-items-center justify-content-center g-2 footer-subscribe-row">
249
+ {% if _footer_nl_on %}
229
250
  <div class="col-12 col-md-8 col-lg-8">
230
- <form class="row g-2 footer-subscribe-form" aria-label="Newsletter signup" onsubmit="return false;">
251
+ <form class="row g-2 footer-subscribe-form" aria-label="{{ ui.newsletter_label | default: 'Newsletter signup' | escape }}" action="{{ _footer_nl_endpoint | escape }}" method="{{ _footer_nl.method | default: 'post' | escape }}">
231
252
  <div class="col-8 col-md-8">
232
- <label for="footer-email" class="visually-hidden">Email</label>
233
- <input type="email" name="email" id="footer-email" class="form-control" placeholder="Enter your email" autocomplete="email" disabled aria-describedby="footer-subscribe-hint">
253
+ <label for="footer-email" class="visually-hidden">{{ ui.newsletter_email_label | default: "Email" }}</label>
254
+ <input type="email" name="{{ _footer_nl.email_field | default: 'email' | escape }}" id="footer-email" class="form-control" placeholder="{{ ui.newsletter_placeholder | default: 'Enter your email' | escape }}" autocomplete="email" required>
234
255
  </div>
235
256
  <div class="col-4 col-md-4">
236
- <button type="button" class="btn btn-primary w-100" disabled title="Configure a newsletter endpoint in your site config">Subscribe</button>
237
- </div>
238
- <div class="col-12">
239
- {% comment %} The describedby target must stay in the a11y tree at every width (#522); the d-none paragraph is the sighted ≥md duplicate only. {% endcomment %}
240
- <span id="footer-subscribe-hint" class="visually-hidden">Newsletter is a placeholder until you connect a provider.</span>
241
- <p class="small text-white-50 mb-0 d-none d-md-block" aria-hidden="true">Newsletter is a placeholder until you connect a provider.</p>
257
+ <button type="submit" class="btn btn-primary w-100">{{ ui.newsletter_subscribe | default: "Subscribe" }}</button>
242
258
  </div>
243
259
  </form>
244
260
  </div>
245
- <div class="col-12 col-md-4 col-lg-4 text-md-end text-lg-end footer-policy-links">
261
+ {% endif %}
262
+ <div class="{{ _footer_policy_cols }} footer-policy-links">
246
263
  <ul class="list-inline mb-0">
247
264
  {% comment %} Only render policy links whose pages exist (or that are explicitly configured). {% endcomment %}
248
265
  {% assign _privacy_needle = "|/privacy-policy/|" %}
@@ -255,11 +272,15 @@
255
272
  {% if site.terms_of_service_url or footer_page_urls contains _terms_needle or footer_page_urls contains _terms_alt_needle %}
256
273
  <li class="list-inline-item"><a href="{{ site.terms_of_service_url | default: '/terms-of-service' | relative_url }}" class="text-light text-decoration-none">Terms of Service</a></li>
257
274
  {% endif %}
275
+ {% comment %} Same gate as the banner in root.html: no modal, no button (#566). {% endcomment %}
276
+ {% capture _needs_consent %}{% include components/cookie-consent-needed.html %}{% endcapture %}
277
+ {% if _needs_consent == "true" %}
258
278
  <li class="list-inline-item">
259
279
  <button type="button" class="footer-inline-button text-light text-decoration-none" data-bs-toggle="modal" data-bs-target="#cookieSettingsModal">
260
280
  Cookie Preferences
261
281
  </button>
262
282
  </li>
283
+ {% endif %}
263
284
  </ul>
264
285
  </div>
265
286
  </div>