From d7cab414a7b777aadcdf7625d346e302d8406be1 Mon Sep 17 00:00:00 2001 From: Alex Shpak Date: Sun, 21 Sep 2025 02:06:44 +0200 Subject: [PATCH] #676, Add support for copytight hugo configuration --- assets/_main.scss | 12 +++++++++++- exampleSite/hugo.toml | 2 ++ exampleSite/hugo.yaml | 2 ++ layouts/_partials/docs/copyright.html | 1 + layouts/_partials/docs/footer.html | 8 ++++---- layouts/_partials/docs/post-meta.html | 2 +- layouts/_partials/docs/post-prev-next.html | 8 ++++---- layouts/baseof.html | 13 +++++++++++-- 8 files changed, 36 insertions(+), 12 deletions(-) create mode 100644 layouts/_partials/docs/copyright.html diff --git a/assets/_main.scss b/assets/_main.scss index 8c21806..a390578 100644 --- a/assets/_main.scss +++ b/assets/_main.scss @@ -37,6 +37,10 @@ img { vertical-align: baseline; } +small { + @extend .text-small; +} + :focus { @include outline; } @@ -315,10 +319,12 @@ body[dir="rtl"] .book-menu { font-size: $font-size-14; a { - margin: $padding-8 0; + margin: $padding-4 0; + padding: $padding-4 0; } a.flex { + display: inline-flex; gap: $padding-8; } } @@ -327,6 +333,10 @@ body[dir="rtl"] .book-menu { margin-top: $padding-16; } +.book-copyright { + margin-top: $padding-16; +} + .book-languages { margin-bottom: $padding-16; diff --git a/exampleSite/hugo.toml b/exampleSite/hugo.toml index a5aa8cb..66d5700 100644 --- a/exampleSite/hugo.toml +++ b/exampleSite/hugo.toml @@ -4,6 +4,8 @@ baseURL = 'http://0.0.0.0:1313/hugo-book/' title = 'Hugo Book' theme = 'hugo-book' +copyright = '[© CC BY 4.0](https://creativecommons.org/licenses/by/4.0/legalcode)' + # Book configuration disablePathToLower = true enableGitInfo = true diff --git a/exampleSite/hugo.yaml b/exampleSite/hugo.yaml index d404579..4b6401a 100644 --- a/exampleSite/hugo.yaml +++ b/exampleSite/hugo.yaml @@ -4,6 +4,8 @@ baseURL: http://0.0.0.0:1313/hugo-book/ title: Hugo Book theme: hugo-book +copyright: "[© CC BY 4.0](https://creativecommons.org/licenses/by/4.0/legalcode)" + # Book configuration disablePathToLower: true enableGitInfo: true diff --git a/layouts/_partials/docs/copyright.html b/layouts/_partials/docs/copyright.html new file mode 100644 index 0000000..960b3d6 --- /dev/null +++ b/layouts/_partials/docs/copyright.html @@ -0,0 +1 @@ +{{ .Site.Title }} - {{ .Site.Copyright | .RenderString }} \ No newline at end of file diff --git a/layouts/_partials/docs/footer.html b/layouts/_partials/docs/footer.html index 01d8322..01b253a 100644 --- a/layouts/_partials/docs/footer.html +++ b/layouts/_partials/docs/footer.html @@ -1,23 +1,23 @@
-{{ if and .GitInfo .Site.Params.BookLastChangeLink }}
+{{ if and .GitInfo .Site.Params.BookLastChangeLink }} {{- $date := partial "docs/date" (dict "Date" .Lastmod "Format" .Site.Params.BookDateFormat) -}} {{ $date }} -
{{ end }} +
-{{ if and .File .Site.Params.BookEditLink }}
+{{ if and .File .Site.Params.BookEditLink }} {{ i18n "Edit this page" }} -
{{ end }} + diff --git a/layouts/_partials/docs/post-meta.html b/layouts/_partials/docs/post-meta.html index 457e2c0..6410cef 100644 --- a/layouts/_partials/docs/post-meta.html +++ b/layouts/_partials/docs/post-meta.html @@ -1,6 +1,6 @@ {{ with .Date }}
- + {{ partial "docs/date" (dict "Date" . "Format" $.Site.Params.BookDateFormat) }}
{{ end }} diff --git a/layouts/_partials/docs/post-prev-next.html b/layouts/_partials/docs/post-prev-next.html index d7192c0..c7832d2 100644 --- a/layouts/_partials/docs/post-prev-next.html +++ b/layouts/_partials/docs/post-prev-next.html @@ -1,18 +1,18 @@
- +
{{ with .NextInSection }} Previous {{ partial "docs/title" . }} {{ end }} - - +
+
{{ with .PrevInSection }} {{ partial "docs/title" . }} Next {{ end }} - +
\ No newline at end of file diff --git a/layouts/baseof.html b/layouts/baseof.html index 2e6b0a9..fd3cfd1 100644 --- a/layouts/baseof.html +++ b/layouts/baseof.html @@ -1,5 +1,5 @@ - + {{ partial "docs/html-head" . }} {{ partial "docs/inject/head" . }} @@ -21,10 +21,11 @@ - {{ template "comments" . }} @@ -61,6 +62,14 @@ {{ partial "docs/footer" . }} {{ end }} +{{ define "copyright" }} +{{ if .Site.Copyright }} + +{{ end }} +{{ end }} + {{ define "comments" }} {{ if and .Content (default true (default .Site.Params.BookComments .Params.BookComments)) }}