#676, Add support for copytight hugo configuration

This commit is contained in:
Alex Shpak
2025-09-21 02:06:44 +02:00
parent 1bd1cedd8d
commit d7cab414a7
8 changed files with 36 additions and 12 deletions
+11 -1
View File
@@ -37,6 +37,10 @@ img {
vertical-align: baseline; vertical-align: baseline;
} }
small {
@extend .text-small;
}
:focus { :focus {
@include outline; @include outline;
} }
@@ -315,10 +319,12 @@ body[dir="rtl"] .book-menu {
font-size: $font-size-14; font-size: $font-size-14;
a { a {
margin: $padding-8 0; margin: $padding-4 0;
padding: $padding-4 0;
} }
a.flex { a.flex {
display: inline-flex;
gap: $padding-8; gap: $padding-8;
} }
} }
@@ -327,6 +333,10 @@ body[dir="rtl"] .book-menu {
margin-top: $padding-16; margin-top: $padding-16;
} }
.book-copyright {
margin-top: $padding-16;
}
.book-languages { .book-languages {
margin-bottom: $padding-16; margin-bottom: $padding-16;
+2
View File
@@ -4,6 +4,8 @@ baseURL = 'http://0.0.0.0:1313/hugo-book/'
title = 'Hugo Book' title = 'Hugo Book'
theme = 'hugo-book' theme = 'hugo-book'
copyright = '[© CC BY 4.0](https://creativecommons.org/licenses/by/4.0/legalcode)'
# Book configuration # Book configuration
disablePathToLower = true disablePathToLower = true
enableGitInfo = true enableGitInfo = true
+2
View File
@@ -4,6 +4,8 @@ baseURL: http://0.0.0.0:1313/hugo-book/
title: Hugo Book title: Hugo Book
theme: hugo-book theme: hugo-book
copyright: "[© CC BY 4.0](https://creativecommons.org/licenses/by/4.0/legalcode)"
# Book configuration # Book configuration
disablePathToLower: true disablePathToLower: true
enableGitInfo: true enableGitInfo: true
+1
View File
@@ -0,0 +1 @@
<small>{{ .Site.Title }} - {{ .Site.Copyright | .RenderString }}</small>
+4 -4
View File
@@ -1,23 +1,23 @@
<div class="flex flex-wrap justify-between"> <div class="flex flex-wrap justify-between">
{{ if and .GitInfo .Site.Params.BookLastChangeLink }}
<div> <div>
{{ if and .GitInfo .Site.Params.BookLastChangeLink }}
{{- $date := partial "docs/date" (dict "Date" .Lastmod "Format" .Site.Params.BookDateFormat) -}} {{- $date := partial "docs/date" (dict "Date" .Lastmod "Format" .Site.Params.BookDateFormat) -}}
<a class="flex align-center" href="{{ partial "docs/links/commit" . }}" title='{{ i18n "Last modified by" }} {{ .GitInfo.AuthorName }} | {{ $date }}' target="_blank" rel="noopener"> <a class="flex align-center" href="{{ partial "docs/links/commit" . }}" title='{{ i18n "Last modified by" }} {{ .GitInfo.AuthorName }} | {{ $date }}' target="_blank" rel="noopener">
<img src="{{ "svg/calendar.svg" | relURL }}" class="book-icon" alt="" /> <img src="{{ "svg/calendar.svg" | relURL }}" class="book-icon" alt="" />
<span>{{ $date }}</span> <span>{{ $date }}</span>
</a> </a>
</div>
{{ end }} {{ end }}
</div>
{{ if and .File .Site.Params.BookEditLink }}
<div> <div>
{{ if and .File .Site.Params.BookEditLink }}
<a class="flex align-center" href="{{ partial "docs/links/edit" . }}" target="_blank" rel="noopener edit"> <a class="flex align-center" href="{{ partial "docs/links/edit" . }}" target="_blank" rel="noopener edit">
<img src="{{ "svg/edit.svg" | relURL }}" class="book-icon" alt="" /> <img src="{{ "svg/edit.svg" | relURL }}" class="book-icon" alt="" />
<span>{{ i18n "Edit this page" }}</span> <span>{{ i18n "Edit this page" }}</span>
</a> </a>
</div>
{{ end }} {{ end }}
</div>
</div> </div>
+1 -1
View File
@@ -1,6 +1,6 @@
{{ with .Date }} {{ with .Date }}
<div class="flex align-center text-small book-post-date"> <div class="flex align-center text-small book-post-date">
<img src="{{ "svg/calendar.svg" | relURL }}" class="book-icon " alt="" /> <img src="{{ "svg/calendar.svg" | relURL }}" class="book-icon" alt="" />
<span>{{ partial "docs/date" (dict "Date" . "Format" $.Site.Params.BookDateFormat) }}</span> <span>{{ partial "docs/date" (dict "Date" . "Format" $.Site.Params.BookDateFormat) }}</span>
</div> </div>
{{ end }} {{ end }}
+4 -4
View File
@@ -1,18 +1,18 @@
<div class="flex flex-wrap justify-between"> <div class="flex flex-wrap justify-between">
<span> <div>
{{ with .NextInSection }} {{ with .NextInSection }}
<a href="{{ .RelPermalink }}" class="flex align-center"> <a href="{{ .RelPermalink }}" class="flex align-center">
<img src="{{ "svg/backward.svg" | relURL }}" class="book-icon" alt="Previous" title="{{ partial "docs/title" . }}" /> <img src="{{ "svg/backward.svg" | relURL }}" class="book-icon" alt="Previous" title="{{ partial "docs/title" . }}" />
<span>{{ partial "docs/title" . }}</span> <span>{{ partial "docs/title" . }}</span>
</a> </a>
{{ end }} {{ end }}
</span> </div>
<span> <div>
{{ with .PrevInSection }} {{ with .PrevInSection }}
<a href="{{ .RelPermalink }}" class="flex align-center"> <a href="{{ .RelPermalink }}" class="flex align-center">
<span>{{ partial "docs/title" . }}</span> <span>{{ partial "docs/title" . }}</span>
<img src="{{ "svg/forward.svg" | relURL }}" class="book-icon" alt="Next" title="{{ partial "docs/title" . }}" /> <img src="{{ "svg/forward.svg" | relURL }}" class="book-icon" alt="Next" title="{{ partial "docs/title" . }}" />
</a> </a>
{{ end }} {{ end }}
</span> </div>
</div> </div>
+11 -2
View File
@@ -1,5 +1,5 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="{{ default .Site.Language.Lang .Site.LanguageCode }}" dir="{{ default "ltr" .Site.Language.LanguageDirection }}"> <html lang="{{ default .Site.Language.Lang .Site.LanguageCode }}" dir="{{ default "ltr" .Site.Language.LanguageDirection }}">
<head> <head>
{{ partial "docs/html-head" . }} {{ partial "docs/html-head" . }}
{{ partial "docs/inject/head" . }} {{ partial "docs/inject/head" . }}
@@ -21,10 +21,11 @@
<footer class="book-footer"> <footer class="book-footer">
{{ template "footer" . }} <!-- Footer under page content --> {{ template "footer" . }} <!-- Footer under page content -->
{{ template "comments" . }} <!-- Comments block -->
{{ partial "docs/inject/footer" . }} {{ partial "docs/inject/footer" . }}
{{ template "copyright" . }} <!-- Copyright block -->
</footer> </footer>
{{ template "comments" . }} <!-- Comments block -->
<label for="menu-control" class="hidden book-menu-overlay"></label> <label for="menu-control" class="hidden book-menu-overlay"></label>
</div> </div>
@@ -61,6 +62,14 @@
{{ partial "docs/footer" . }} {{ partial "docs/footer" . }}
{{ end }} {{ end }}
{{ define "copyright" }}
{{ if .Site.Copyright }}
<div class="book-copyright flex justify-center">
{{ partial "docs/copyright" . }}
</div>
{{ end }}
{{ end }}
{{ define "comments" }} {{ define "comments" }}
{{ if and .Content (default true (default .Site.Params.BookComments .Params.BookComments)) }} {{ if and .Content (default true (default .Site.Params.BookComments .Params.BookComments)) }}
<div class="book-comments"> <div class="book-comments">