From 1f0c9ae56024ee8cf668fbeb236c0af1c8b8d1d1 Mon Sep 17 00:00:00 2001 From: Bruno Carlin Date: Sun, 6 Jul 2025 14:22:12 +0200 Subject: [PATCH 1/6] feat: add a table of content on blog posts --- assets/static/css/bcarlin.css | 37 +++++++++++++++++++++++++++++++++++ config/_default/hugo.yaml | 2 ++ i18n/en.yaml | 1 + i18n/fr.yaml | 1 + layouts/blog/single.html | 10 ++++++++++ 5 files changed, 51 insertions(+) diff --git a/assets/static/css/bcarlin.css b/assets/static/css/bcarlin.css index b00a9f7..f3f1961 100644 --- a/assets/static/css/bcarlin.css +++ b/assets/static/css/bcarlin.css @@ -266,6 +266,43 @@ main { } } + section.table-of-contents { + font-size: 0.9em; + margin-block-end: 2em; + margin-inline-start: 1em; + padding-inline-start: 1em; + border-inline-start: 1px solid var(--pico-muted-color); + + + p { + margin-bottom: 0; /* reset pico styles */ + margin-block-end: 0.2em; + font-weight: bold; + } + + nav { + ol { + &:last-of-type { + margin-right: initial; /* reset pico styles */ + } + + &:first-of-type { + margin-left: initial; /* reset pico styles */ + } + + li { + display: list-item; /* reset pico styles */ + padding: initial; /* reset pico styles */ + list-style-type: none; + + ol { + margin-inline-start: 1em !important; + } + } + } + } + } + ul > li { list-style-type: disc; } diff --git a/config/_default/hugo.yaml b/config/_default/hugo.yaml index 3427092..d015ad6 100644 --- a/config/_default/hugo.yaml +++ b/config/_default/hugo.yaml @@ -41,3 +41,5 @@ markup: goldmark: parser: wrapStandAloneImageWithinParagraph: false + tableOfContents: + ordered: true diff --git a/i18n/en.yaml b/i18n/en.yaml index e886410..2b3a6c2 100644 --- a/i18n/en.yaml +++ b/i18n/en.yaml @@ -18,3 +18,4 @@ tags: Tags information_icon: Information icon warning_icon: Warning icon also_available_in: "Also available in:" +table_of_contents: "Contents:" diff --git a/i18n/fr.yaml b/i18n/fr.yaml index acb8a4d..8225ca2 100644 --- a/i18n/fr.yaml +++ b/i18n/fr.yaml @@ -18,3 +18,4 @@ tags: Tags information_icon: Icône information warning_icon: Icône attention also_available_in: "Également disponible en :" +table_of_contents: "Contenu :" diff --git a/layouts/blog/single.html b/layouts/blog/single.html index e7933c4..6c9a8fe 100644 --- a/layouts/blog/single.html +++ b/layouts/blog/single.html @@ -23,6 +23,16 @@ + + {{ with .TableOfContents }} + {{- if ne . `` }} +
+

{{ T "table_of_contents" }}

+ {{ . }} +
+ {{- end }} + {{- end }} +
{{ .Content }}
From ceb1d7ae03f026b1e1dadb71403aa585549165c3 Mon Sep 17 00:00:00 2001 From: Bruno Carlin Date: Sun, 6 Jul 2025 14:22:12 +0200 Subject: [PATCH 2/6] fix(theme): fixes the spacing between list items --- assets/static/css/bcarlin.css | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/assets/static/css/bcarlin.css b/assets/static/css/bcarlin.css index f3f1961..cada063 100644 --- a/assets/static/css/bcarlin.css +++ b/assets/static/css/bcarlin.css @@ -303,7 +303,11 @@ main { } } - ul > li { + :where(ol,ul) li { + margin-bottom: 0;; + } + + ul li { list-style-type: disc; } From c321629dd2c4cf83c7d17b2ac4760e50260a5fa6 Mon Sep 17 00:00:00 2001 From: Bruno Carlin Date: Sun, 6 Jul 2025 14:22:12 +0200 Subject: [PATCH 3/6] fix(theme): update the markup and styling of translastions --- assets/static/css/bcarlin.css | 4 +++- i18n/en.yaml | 1 + i18n/fr.yaml | 1 + layouts/baseof.html | 4 ++-- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/assets/static/css/bcarlin.css b/assets/static/css/bcarlin.css index cada063..daf7192 100644 --- a/assets/static/css/bcarlin.css +++ b/assets/static/css/bcarlin.css @@ -236,7 +236,9 @@ body { main { .translations { text-align: end; - margin-bottom: 0.3em; + margin-block-end: 0.3em; + padding-inline-end: 2em; + font-size: 0.9em; a { text-decoration: none; diff --git a/i18n/en.yaml b/i18n/en.yaml index 2b3a6c2..59d3bf3 100644 --- a/i18n/en.yaml +++ b/i18n/en.yaml @@ -17,5 +17,6 @@ permalink_section: "Permalink to this section" tags: Tags information_icon: Information icon warning_icon: Warning icon +translations: Translations also_available_in: "Also available in:" table_of_contents: "Contents:" diff --git a/i18n/fr.yaml b/i18n/fr.yaml index 8225ca2..baff459 100644 --- a/i18n/fr.yaml +++ b/i18n/fr.yaml @@ -17,5 +17,6 @@ permalink_section: Permalien vers cette partie tags: Tags information_icon: Icône information warning_icon: Icône attention +translations: Traductions also_available_in: "Également disponible en :" table_of_contents: "Contenu :" diff --git a/layouts/baseof.html b/layouts/baseof.html index 6db0687..efe3805 100644 --- a/layouts/baseof.html +++ b/layouts/baseof.html @@ -38,12 +38,12 @@
{{- if .IsTranslated }} {{- range .Translations }} - + {{- end }} {{- end }} From cfb55c355fe92b83d3aa142637501f84085cfd87 Mon Sep 17 00:00:00 2001 From: Bruno Carlin Date: Sun, 6 Jul 2025 14:22:12 +0200 Subject: [PATCH 4/6] feat(theme): add a prompt to react by email --- config/_default/hugo.yaml | 2 +- layouts/blog/single.html | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/config/_default/hugo.yaml b/config/_default/hugo.yaml index d015ad6..5d615c3 100644 --- a/config/_default/hugo.yaml +++ b/config/_default/hugo.yaml @@ -7,7 +7,7 @@ copyright: '© 2025 Bruno Carlin' summaryLength: 15 params: author: - email: mail@bcarlin.net + email: blog@mail.bcarlin.net name: Bruno Carlin languages: diff --git a/layouts/blog/single.html b/layouts/blog/single.html index 6c9a8fe..25beffa 100644 --- a/layouts/blog/single.html +++ b/layouts/blog/single.html @@ -36,5 +36,9 @@
{{ .Content }}
+ + {{ end }} From 980eb804a6dc7db18bc422dba79fa9f2720ac305 Mon Sep 17 00:00:00 2001 From: Bruno Carlin Date: Sun, 6 Jul 2025 14:22:12 +0200 Subject: [PATCH 5/6] feat(theme): add a link to my forge in the menu --- config/_default/menus.en.yaml | 13 ++++++++++--- config/_default/menus.fr.yaml | 13 ++++++++++--- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/config/_default/menus.en.yaml b/config/_default/menus.en.yaml index 627d8d0..b93efae 100644 --- a/config/_default/menus.en.yaml +++ b/config/_default/menus.en.yaml @@ -10,9 +10,16 @@ weight: 20 secondary: + - name: 'Projects' + url: 'https://code.bcarlin.net' + weight: 10 + params: + iconName: "git-pull-request-fill" + iconTitle: "My software forge" + - name: '@bcarlin@hachyderm.io' url: 'https://hachyderm.io/@bcarlin' - weight: 10 + weight: 20 params: rel: "me" iconName: "mastodon-fill" @@ -20,7 +27,7 @@ - name: 'LinkedIn' url: 'https://www.linkedin.com/in/brunocarlin' - weight: 20 + weight: 30 params: rel: "me" iconName: "linkedin-fill" @@ -28,7 +35,7 @@ - name: 'GPG Key' url: '/bcarlin.gpg' - weight: 30 + weight: 40 params: class: "u-key" iconName: "key-fill" diff --git a/config/_default/menus.fr.yaml b/config/_default/menus.fr.yaml index 69fcffa..ccddedd 100644 --- a/config/_default/menus.fr.yaml +++ b/config/_default/menus.fr.yaml @@ -10,9 +10,16 @@ weight: 20 secondary: + - name: 'Projets' + url: 'https://code.bcarlin.net' + weight: 10 + params: + iconName: "git-pull-request-fill" + iconTitle: "Ma forge logicielle" + - name: '@bcarlin@hachyderm.io' url: 'https://hachyderm.io/@bcarlin' - weight: 10 + weight: 20 params: rel: "me" iconName: "mastodon-fill" @@ -20,7 +27,7 @@ - name: 'LinkedIn' url: 'https://www.linkedin.com/in/brunocarlin' - weight: 20 + weight: 30 params: rel: "me" iconName: "linkedin-fill" @@ -28,7 +35,7 @@ - name: 'Clef GPG' url: '/bcarlin.gpg' - weight: 30 + weight: 40 params: class: "u-key" iconName: "key-fill" From 82281f93ca27bc8b76795e3172fbf0693944af41 Mon Sep 17 00:00:00 2001 From: Bruno Carlin Date: Sun, 6 Jul 2025 14:22:12 +0200 Subject: [PATCH 6/6] feat(theme): add a link to the source in the footer --- i18n/en.yaml | 3 +++ i18n/fr.yaml | 3 +++ layouts/_partials/footer.html | 2 ++ 3 files changed, 8 insertions(+) diff --git a/i18n/en.yaml b/i18n/en.yaml index 59d3bf3..23c648a 100644 --- a/i18n/en.yaml +++ b/i18n/en.yaml @@ -20,3 +20,6 @@ warning_icon: Warning icon translations: Translations also_available_in: "Also available in:" table_of_contents: "Contents:" +source_code: | + The source of this site is available on + my software forge. diff --git a/i18n/fr.yaml b/i18n/fr.yaml index baff459..9e3fd1b 100644 --- a/i18n/fr.yaml +++ b/i18n/fr.yaml @@ -20,3 +20,6 @@ warning_icon: Icône attention translations: Traductions also_available_in: "Également disponible en :" table_of_contents: "Contenu :" +source_code: | + Les sources de ce site sont disponibles sur + ma forge logicielle. diff --git a/layouts/_partials/footer.html b/layouts/_partials/footer.html index a0f4b73..903a587 100644 --- a/layouts/_partials/footer.html +++ b/layouts/_partials/footer.html @@ -11,4 +11,6 @@ {{partial "icon.html" (dict "icon" "creative-commons-nc-fill" "label" "Creative Commons Non Commercial Logo")}}
{{ T "generated_with_hugo" | safeHTML }} +
+ {{ T "source_code" | safeHTML }}