From 1fc4b74e9fe6a4620c9d209ad5f083ec15624839 Mon Sep 17 00:00:00 2001 From: Levente Polyak Date: Thu, 27 Nov 2025 20:54:38 +0100 Subject: [PATCH 1/5] hugo: update hugo-book theme --- website/layouts/404.html | 35 ---------------- website/layouts/partials/docs/html-head.html | 43 -------------------- website/themes/hugo-book | 2 +- 3 files changed, 1 insertion(+), 79 deletions(-) delete mode 100644 website/layouts/404.html delete mode 100644 website/layouts/partials/docs/html-head.html diff --git a/website/layouts/404.html b/website/layouts/404.html deleted file mode 100644 index 60dcdc6..0000000 --- a/website/layouts/404.html +++ /dev/null @@ -1,35 +0,0 @@ - - - - - {{ partial "docs/html-head" . }} - {{ partial "docs/inject/head" . }} - - - - - -
-
-

404

-

Page Not Found

-

- {{ .Site.Title }} -

-
-
- - {{ partial "docs/inject/body" . }} - {{ template "_internal/google_analytics.html" . }} - - - diff --git a/website/layouts/partials/docs/html-head.html b/website/layouts/partials/docs/html-head.html deleted file mode 100644 index b24730d..0000000 --- a/website/layouts/partials/docs/html-head.html +++ /dev/null @@ -1,43 +0,0 @@ - - - - - -{{- template "_internal/opengraph.html" . -}} - -{{ partial "docs/title" . }} | {{ .Site.Title -}} - -{{- $manifest := resources.Get "manifest.json" | resources.ExecuteAsTemplate "manifest.json" . }} - - - -{{- range .Translations }} - -{{ end -}} - - -{{- $styles := resources.Get "book.scss" | resources.ExecuteAsTemplate "book.scss" . | css.Sass | resources.Minify | resources.Fingerprint }} - - -{{- if default true .Site.Params.BookSearch }} -{{- $searchJSFile := printf "%s.search.js" .Language.Lang }} -{{- $searchJS := resources.Get "search.js" | resources.ExecuteAsTemplate $searchJSFile . | resources.Minify | resources.Fingerprint }} - -{{ end -}} - -{{- if .Site.Params.BookServiceWorker }} -{{- $swJS := resources.Get "sw-register.js" | resources.ExecuteAsTemplate "sw.js" . | resources.Minify | resources.Fingerprint }} - -{{ end -}} - -{{- template "_internal/google_analytics.html" . -}} - - -{{- with .OutputFormats.Get "rss" -}} - {{ printf `` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }} -{{ end -}} - -{{ "" | safeHTML }} diff --git a/website/themes/hugo-book b/website/themes/hugo-book index 9e9c7d3..b7f9c8c 160000 --- a/website/themes/hugo-book +++ b/website/themes/hugo-book @@ -1 +1 @@ -Subproject commit 9e9c7d34038a830d22397bbec08e7ec64eb0a0d7 +Subproject commit b7f9c8cb0f51523f316777a27abba64b10e247f5 From 24bf5a461bd2e8fc6e105415bb61b571717a139d Mon Sep 17 00:00:00 2001 From: Levente Polyak Date: Thu, 27 Nov 2025 22:32:48 +0100 Subject: [PATCH 2/5] hugo: use new hugo-book edit link feature Remove custom footer template and only override the edit link partial with the custom book index replace logic. This helps to reduce future incompatibility by minimizing overwritten templates. --- website/config.toml | 2 +- website/layouts/partials/docs/footer.html | 25 ------------------- website/layouts/partials/docs/links/edit.html | 5 ++++ 3 files changed, 6 insertions(+), 26 deletions(-) delete mode 100644 website/layouts/partials/docs/footer.html create mode 100644 website/layouts/partials/docs/links/edit.html diff --git a/website/config.toml b/website/config.toml index 23c9dd1..82b3b7f 100644 --- a/website/config.toml +++ b/website/config.toml @@ -29,7 +29,7 @@ theme = "hugo-book" BookPortableLinks = true BookRepo = 'https://github.com/uapi-group/kernel-features' BookCommitPath = 'commit' - BookEditPath = 'edit/main' + BookEditLink = '{{ .Site.Params.BookRepo }}/edit/main/{{ .Path }}' BookIndexPage = 'README.md' [modules] diff --git a/website/layouts/partials/docs/footer.html b/website/layouts/partials/docs/footer.html deleted file mode 100644 index defbd70..0000000 --- a/website/layouts/partials/docs/footer.html +++ /dev/null @@ -1,25 +0,0 @@ -
-{{ if hugo.IsMultilingual }} - {{ partial "docs/languages" . }} -{{ end }} - -{{ if and .GitInfo .Site.Params.BookRepo }} -
- {{- $date := partial "docs/date" (dict "Date" .GitInfo.AuthorDate.Local "Format" .Site.Params.BookDateFormat) -}} - {{- $commitPath := default "commit" .Site.Params.BookCommitPath -}} - - Calendar - {{ $date }} - -
-{{ end }} - -{{ if and .File .Site.Params.BookRepo .Site.Params.BookEditPath }} -
- - Edit - {{ i18n "Edit this page" }} - -
-{{ end }} -
diff --git a/website/layouts/partials/docs/links/edit.html b/website/layouts/partials/docs/links/edit.html new file mode 100644 index 0000000..02e8501 --- /dev/null +++ b/website/layouts/partials/docs/links/edit.html @@ -0,0 +1,5 @@ +{{- return (partial "docs/text/template" (dict "Template" .Site.Params.BookEditLink "Context" (dict +"Site" .Site +"Page" .Page +"Path" (strings.TrimPrefix hugo.WorkingDir ( replace .Page.File.Path "_index.md" .Site.Params.BookIndexPage)) +)) | urls.JoinPath) -}} From 77c46d30709b55fc902acda63148821076cb8cb7 Mon Sep 17 00:00:00 2001 From: Levente Polyak Date: Thu, 27 Nov 2025 23:05:06 +0100 Subject: [PATCH 3/5] hugo: replace threedash menu separator with css This makes the menu separator a stylistic element and reduces the need for a custom hugo-menu template to skip treating the menu element as a link item. This helps to reduce future incompatibility by minimizing overwritten templates. --- website/assets/_custom.scss | 5 +++++ website/config.toml | 9 --------- 2 files changed, 5 insertions(+), 9 deletions(-) create mode 100644 website/assets/_custom.scss diff --git a/website/assets/_custom.scss b/website/assets/_custom.scss new file mode 100644 index 0000000..3859722 --- /dev/null +++ b/website/assets/_custom.scss @@ -0,0 +1,5 @@ +nav>ul:last-of-type>li:last-child::before { + content: "⸻"; + display: inline-block; + margin: 0.5em 0; +} diff --git a/website/config.toml b/website/config.toml index 82b3b7f..677c6a9 100644 --- a/website/config.toml +++ b/website/config.toml @@ -7,15 +7,6 @@ theme = "hugo-book" name = "⬅️ Back to top" url = "https://uapi-group.org/" weight = 1 -[[menu.before]] - name = "⸻" - weight = 2 - -# Uncomment to show second separator after more content files were added -# -#[[menu.after]] -# name = "⸻" -# weight = 10 [[menu.after]] name = "Collaborate on Github" From b16eb18e002a31ced29fc8bd3a8217a9314ec646 Mon Sep 17 00:00:00 2001 From: Levente Polyak Date: Thu, 27 Nov 2025 23:43:30 +0100 Subject: [PATCH 4/5] hugo: use menu element urls relative to the base url By using relative URLs, which are resolved from the defined base url, the menu link will not be considered a remote link and will subsequently leave the link to be opened in the same page. The hugo resolved URL on build will be the same as the absolute variant. This helps to reduce future incompatibility by minimizing overwritten templates. --- website/config.toml | 2 +- website/layouts/partials/docs/menu-hugo.html | 32 -------------------- 2 files changed, 1 insertion(+), 33 deletions(-) delete mode 100644 website/layouts/partials/docs/menu-hugo.html diff --git a/website/config.toml b/website/config.toml index 677c6a9..a3bd357 100644 --- a/website/config.toml +++ b/website/config.toml @@ -5,7 +5,7 @@ theme = "hugo-book" [[menu.before]] name = "⬅️ Back to top" - url = "https://uapi-group.org/" + url = "/.." weight = 1 [[menu.after]] diff --git a/website/layouts/partials/docs/menu-hugo.html b/website/layouts/partials/docs/menu-hugo.html deleted file mode 100644 index 168d24c..0000000 --- a/website/layouts/partials/docs/menu-hugo.html +++ /dev/null @@ -1,32 +0,0 @@ - -{{ if . }} - {{ template "book-menu-hugo" . }} -{{ end }} - -{{ define "book-menu-hugo" }} - -{{ end }} From 3066a535c5e13d2959eed930029658250df6bb6e Mon Sep 17 00:00:00 2001 From: Levente Polyak Date: Fri, 28 Nov 2025 01:02:48 +0100 Subject: [PATCH 5/5] hugo: set book theme to auto to support light/dark mode --- website/config.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/website/config.toml b/website/config.toml index a3bd357..8702d75 100644 --- a/website/config.toml +++ b/website/config.toml @@ -22,6 +22,7 @@ theme = "hugo-book" BookCommitPath = 'commit' BookEditLink = '{{ .Site.Params.BookRepo }}/edit/main/{{ .Path }}' BookIndexPage = 'README.md' + BookTheme = 'auto' [modules] [[module.mounts]]