From 20224e00aa1a2abcd190f6473c05eb3102273bb4 Mon Sep 17 00:00:00 2001 From: Arnaud Ligny Date: Tue, 20 Oct 2026 23:11:39 +0200 Subject: [PATCH 01/13] refactor(nav): compute the children of a section without loops Sub-sections and pages are merged and sorted in a single expression (instead of merging an array at each iteration), and the ancestors ids of the current page are computed once for the whole sidebar. Co-Authored-By: Claude Opus 5.5 --- layouts/docs/list.html.twig | 12 ++---------- layouts/partials/sidebar-nav.html.twig | 14 +++----------- 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/layouts/docs/list.html.twig b/layouts/docs/list.html.twig index 979e501..c9e997d 100644 --- a/layouts/docs/list.html.twig +++ b/layouts/docs/list.html.twig @@ -9,18 +9,10 @@ {#- sub-sections and pages of the section ~#} {%- block after_content ~%} - {%- set children = [] ~%} - {%- for s in page.sections ~%} - {%- set children = children|merge([s]) ~%} - {%- endfor ~%} - {%- for p in page.pages.showable ~%} - {%- if p.type != 'section' and p.parent and p.parent.id == page.id ~%} - {%- set children = children|merge([p]) ~%} - {%- endif ~%} - {%- endfor ~%} + {%- set children = page.sections|merge(page.pages.showable|filter(p => p.type != 'section' and p.parent and p.parent.id == page.id))|sort_by_weight ~%} {%- if children is not empty ~%}
From 2dc4afc135de4462282476676c0d9e9d128a1082 Mon Sep 17 00:00:00 2001 From: Arnaud Ligny Date: Tue, 20 Oct 2026 23:20:25 +0200 Subject: [PATCH 07/13] feat(a11y): theme toggle button with pressed state "Dark theme" toggle button with `aria-pressed`, instead of a "Change theme color" button without state. Co-Authored-By: Claude Opus 5.5 --- .../partials/selector-theme-icon.html.twig | 5 +++-- translations/messages.fr.mo | Bin 1701 -> 1678 bytes translations/messages.fr.po | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/layouts/partials/selector-theme-icon.html.twig b/layouts/partials/selector-theme-icon.html.twig index 1af1f08..da8c568 100644 --- a/layouts/partials/selector-theme-icon.html.twig +++ b/layouts/partials/selector-theme-icon.html.twig @@ -1,5 +1,5 @@ -{#- theme switcher (icons are switched by the `dark` class) ~#} - @@ -22,6 +22,7 @@ function applyTheme() { const theme = storedTheme() || (systemDark.matches ? 'dark' : 'light'); document.documentElement.classList.toggle('dark', theme === 'dark'); + document.getElementById('theme-toggle').setAttribute('aria-pressed', theme === 'dark' ? 'true' : 'false'); if (theme === 'dark') { document.documentElement.dataset.theme = 'dark'; } else { diff --git a/translations/messages.fr.mo b/translations/messages.fr.mo index 655a6fb7e4b9782629371e698cb749afe2563949..53041d97f3b7c5655a63fa44f74c97fa002e9edb 100644 GIT binary patch delta 485 zcmXZYKTE@K5P;z`X|=}08pYy2v@YT#6ciLe92{Ik2SKnd3XwtxYIKiErwT=M5}X7< zaFR~q;NaHPFCcye9UOg+9)vu(%iaAhc?_Dtbv^S$h6RU(L^W3hucbm^vxAUa5CqaD%~qgh-6MQA4xyQs4T zaS}2)iTDP612^#r6de2?av|h*&$;K^dy;EwXx&^zwo>ZHP-+}=W}=NLVh7W>ij%mG zS=`id8Ktg*d93RF18p50@@!A%;8@uN+!zinHdrVTt-L7CG8H%AXVg1yS!wO zeQiT~j-0K!CIr)QNAD#$P Date: Tue, 20 Oct 2026 23:20:25 +0200 Subject: [PATCH 08/13] perf(docs): load tocbot only if the page has a ToC, add anchors without waiting for load The ToC is computed once, outside of any block, and tocbot (stylesheet and script) is loaded only if it is not empty. Heading anchors are added as soon as the script runs, instead of waiting for all images to be loaded. Co-Authored-By: Claude Opus 5.5 --- layouts/docs/page.html.twig | 38 +++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/layouts/docs/page.html.twig b/layouts/docs/page.html.twig index 0783829..84bffcf 100644 --- a/layouts/docs/page.html.twig +++ b/layouts/docs/page.html.twig @@ -1,7 +1,10 @@ {% extends '_default/page.html.twig' %} -{#- merged with the stylesheets of a template extending this one ~#} -{% set styles_extra = ['https://cdnjs.cloudflare.com/ajax/libs/tocbot/' ~ site.tocbot.version ~ '/tocbot.min.css']|merge(styles_extra ?? []) %} +{#- "On this page" ToC (set outside of any block to be visible in all of them) ~#} +{% set toc = page.body|toc %} +{% set has_toc = toc|striptags|trim is not empty %} +{#- tocbot is loaded only if the page has a ToC; merged with the stylesheets of a template extending this one ~#} +{% set styles_extra = (has_toc ? ['https://cdnjs.cloudflare.com/ajax/libs/tocbot/' ~ site.tocbot.version ~ '/tocbot.min.css'] : [])|merge(styles_extra ?? []) %} {%- block sidebar ~%} {%- embed 'partials/sidebar.html.twig' with {'showlarge': true} ~%} @@ -20,8 +23,6 @@
{{- include('partials/breadcrumb.html.twig') ~}} {#- "On this page" ~#} - {%- set toc = page.body|toc ~%} - {%- set has_toc = toc|striptags|trim is not empty ~%} {%- if has_toc ~%}
@@ -71,10 +72,11 @@ {%- block scripts ~%} {{- parent() ~}} + {%- if has_toc ~%} {{- html(asset('https://cdnjs.cloudflare.com/ajax/libs/tocbot/' ~ site.tocbot.version ~ '/tocbot.min.js', {minify: false})) ~}} + {%- endif ~%} + {#- mermaid (loaded only if the page contains a diagram) ~#} From 4938533ef73fbe30b89c417782c17aa30276d02c Mon Sep 17 00:00:00 2001 From: Arnaud Ligny Date: Tue, 20 Oct 2026 23:20:25 +0200 Subject: [PATCH 09/13] refactor(sidebar): remove the duplicated "Powered by" mention Already displayed in the page footer. Co-Authored-By: Claude Opus 5.5 --- layouts/partials/sidebar.html.twig | 4 ---- 1 file changed, 4 deletions(-) diff --git a/layouts/partials/sidebar.html.twig b/layouts/partials/sidebar.html.twig index 7f3dd28..3208f46 100644 --- a/layouts/partials/sidebar.html.twig +++ b/layouts/partials/sidebar.html.twig @@ -24,10 +24,6 @@ {{- include('partials/selector-language.html.twig', {'label': true}) ~}}
-
-