Skip to content

Commit cd60fd1

Browse files
t-lopoettering
authored andcommitted
hugo: bump version to 0.147.8, address deprecations
This change bumps the Hugo version used to build web pages to v0.147.8 and addresses build issues introduced by functions deprecated in newer hugo versions: - .Site.IsMultiLingual => hugo.IsMultilingual - resources.ToCSS => css.Sass Templates and partials that use deprecated functions are now overridden in layout/. The Hugo version was bumped in gh-pages.yml. Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
1 parent 609b917 commit cd60fd1

File tree

4 files changed

+104
-1
lines changed

4 files changed

+104
-1
lines changed

.github/workflows/gh-pages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Setup Hugo
2222
uses: peaceiris/actions-hugo@v2
2323
with:
24-
hugo-version: '0.104.3'
24+
hugo-version: '0.147.8'
2525
extended: true
2626

2727
- name: Build

layouts/404.html

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<!DOCTYPE html>
2+
<html lang="{{ .Site.Language.Lang }}">
3+
4+
<head>
5+
{{ partial "docs/html-head" . }}
6+
{{ partial "docs/inject/head" . }}
7+
8+
<style>
9+
.not-found {
10+
text-align: center;
11+
}
12+
.not-found h1 {
13+
margin: .25em 0 0 0;
14+
opacity: .25;
15+
font-size: 40vmin;
16+
}
17+
</style>
18+
</head>
19+
20+
<body>
21+
<main class="flex justify-center not-found">
22+
<div>
23+
<h1>404</h1>
24+
<h2>Page Not Found</h2>
25+
<h3>
26+
<a href="{{ .Site.Home.RelPermalink }}">{{ .Site.Title }}</a>
27+
</h3>
28+
</div>
29+
</main>
30+
31+
{{ partial "docs/inject/body" . }}
32+
{{ template "_internal/google_analytics.html" . }}
33+
</body>
34+
35+
</html>

layouts/partials/docs/footer.html

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<div class="flex flex-wrap justify-between">
2+
{{ if hugo.IsMultilingual }}
3+
{{ partial "docs/languages" . }}
4+
{{ end }}
5+
6+
{{ if and .GitInfo .Site.Params.BookRepo }}
7+
<div>
8+
{{- $date := partial "docs/date" (dict "Date" .GitInfo.AuthorDate.Local "Format" .Site.Params.BookDateFormat) -}}
9+
{{- $commitPath := default "commit" .Site.Params.BookCommitPath -}}
10+
<a class="flex align-center" href="{{ .Site.Params.BookRepo }}/{{ $commitPath }}/{{ .GitInfo.Hash }}" title='{{ i18n "Last modified by" }} {{ .GitInfo.AuthorName }} | {{ $date }}' target="_blank" rel="noopener">
11+
<img src="{{ "svg/calendar.svg" | relURL }}" class="book-icon" alt="Calendar" />
12+
<span>{{ $date }}</span>
13+
</a>
14+
</div>
15+
{{ end }}
16+
17+
{{ if and .File .Site.Params.BookRepo .Site.Params.BookEditPath }}
18+
<div>
19+
<a class="flex align-center" href="{{ .Site.Params.BookRepo }}/{{ .Site.Params.BookEditPath }}/{{ .Site.Params.contentDir | default "content" }}/{{ replace .File.Path "\\" "/" }}" target="_blank" rel="noopener">
20+
<img src="{{ "svg/edit.svg" | relURL }}" class="book-icon" alt="Edit" />
21+
<span>{{ i18n "Edit this page" }}</span>
22+
</a>
23+
</div>
24+
{{ end }}
25+
</div>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<meta charset="UTF-8">
2+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
3+
<meta name="description" content="{{ default .Summary .Description }}">
4+
<meta name="theme-color" content="#FFFFFF">
5+
6+
{{- template "_internal/opengraph.html" . -}}
7+
8+
<title>{{ partial "docs/title" . }} | {{ .Site.Title -}}</title>
9+
10+
{{- $manifest := resources.Get "manifest.json" | resources.ExecuteAsTemplate "manifest.json" . }}
11+
<link rel="manifest" href="{{ $manifest.RelPermalink }}">
12+
<link rel="icon" href="{{ "favicon.png" | relURL }}" type="image/x-icon">
13+
14+
{{- range .Translations }}
15+
<link rel="alternate" hreflang="{{ .Language.Lang }}" href="{{ .Permalink }}" title="{{ partial "docs/title" . }}">
16+
{{ end -}}
17+
18+
<!-- Theme stylesheet, you can customize scss by creating `assets/custom.scss` in your website -->
19+
{{- $styles := resources.Get "book.scss" | resources.ExecuteAsTemplate "book.scss" . | css.Sass | resources.Minify | resources.Fingerprint }}
20+
<link rel="stylesheet" href="{{ $styles.RelPermalink }}" integrity="{{ $styles.Data.Integrity }}">
21+
22+
{{- if default true .Site.Params.BookSearch }}
23+
{{- $searchJSFile := printf "%s.search.js" .Language.Lang }}
24+
{{- $searchJS := resources.Get "search.js" | resources.ExecuteAsTemplate $searchJSFile . | resources.Minify | resources.Fingerprint }}
25+
<script defer src="{{ $searchJS.RelPermalink }}" integrity="{{ $searchJS.Data.Integrity }}"></script>
26+
{{ end -}}
27+
28+
{{- if .Site.Params.BookServiceWorker }}
29+
{{- $swJS := resources.Get "sw-register.js" | resources.ExecuteAsTemplate "sw.js" . | resources.Minify | resources.Fingerprint }}
30+
<script defer src="{{ $swJS.RelPermalink }}" integrity="{{ $swJS.Data.Integrity }}"></script>
31+
{{ end -}}
32+
33+
{{- template "_internal/google_analytics.html" . -}}
34+
35+
<!-- RSS -->
36+
{{- with .OutputFormats.Get "rss" -}}
37+
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
38+
{{ end -}}
39+
40+
{{ "<!--" | safeHTML }}
41+
Made with Book Theme
42+
https://github.com/alex-shpak/hugo-book
43+
{{ "-->" | safeHTML }}

0 commit comments

Comments
 (0)