0.158.0 deprecations (#805)

* 0.158.0 changes - using same capitalization as huge docs

* LanguageCode -> Locale
LanguageDirection -> Direction
LanguageName -> Label

* language.lang to language.name

* all changed functions added in 0.158.0
This commit is contained in:
nick n.
2026-04-07 19:57:40 +02:00
committed by GitHub
parent 751bde097b
commit 4f0e89c4ed
13 changed files with 26 additions and 26 deletions
+1 -1
View File
@@ -29,7 +29,7 @@ jobs:
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: 0.146.7
hugo-version: 0.158.0
extended: true
- name: Run Hugo
working-directory: exampleSite
+1 -1
View File
@@ -9,7 +9,7 @@ jobs:
matrix:
hugo-version:
- 'latest'
- '0.146.7'
- '0.158.0'
steps:
- uses: actions/checkout@v4
with:
+2 -2
View File
@@ -1,6 +1,6 @@
# Hugo Book Theme
[![Hugo](https://img.shields.io/badge/hugo-0.146-blue.svg)](https://gohugo.io)
[![Hugo](https://img.shields.io/badge/hugo-0.158-blue.svg)](https://gohugo.io)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
![Build with Hugo](https://github.com/alex-shpak/hugo-book/workflows/Build%20with%20Hugo/badge.svg)
@@ -33,7 +33,7 @@
## Requirements
- Hugo 0.146 or higher
- Hugo 0.158 or higher
- Hugo extended version, [Installation Instructions](https://gohugo.io/installation/)
## Installation
+1 -1
View File
@@ -1,6 +1,6 @@
'use strict';
{{ $searchDataFile := printf "%s.search-data.json" .Language.Lang }}
{{ $searchDataFile := printf "%s.search-data.json" .Language.Name }}
{{ $searchData := resources.Get "search-data.json" | resources.ExecuteAsTemplate $searchDataFile . | resources.Minify | resources.Fingerprint }}
{{ $searchConfig := i18n "bookSearchConfig" | default "{}" }}
+1 -1
View File
@@ -8,7 +8,7 @@ layout: landing
# HUGO BOOK {anchor=false}
[Hugo](https://gohugo.io) documentation theme as simple as plain book
[{{< badge style="info" title="Hugo" value="0.146" >}}](https://github.com/gohugoio/hugo/releases/tag/v0.146.7)
[{{< badge style="info" title="Hugo" value="0.158" >}}](https://github.com/gohugoio/hugo/releases/tag/v0.158.0)
[{{< badge style="default" title="License" value="MIT" >}}](https://github.com/alex-shpak/hugo-book/blob/main/LICENSE)
{{<button href="/docs/example">}}Explore{{</button>}}
+4 -4
View File
@@ -31,19 +31,19 @@ enableGitInfo = true
# And https://gohugo.io/content-management/multilingual/#translation-by-content-directory
[languages]
[languages.en]
languageName = 'English'
label = 'English'
contentDir = 'content.en'
weight = 1
[languages.zh]
languageName = 'Chinese'
label = 'Chinese'
contentDir = 'content.zh'
weight = 2
[languages.he]
languageName = 'Hebrew'
label = 'Hebrew'
contentDir = 'content.he'
languageDirection = 'rtl'
direction = 'rtl'
weight = 3
[menu]
+4 -4
View File
@@ -30,17 +30,17 @@ markup:
# And https://gohugo.io/content-management/multilingual/#translation-by-content-directory
languages:
en:
languageName: English
label: English
contentDir: content.en
weight: 1
zh:
languageName: Chinese
label: Chinese
contentDir: content.zh
weight: 2
he:
languageName: Hebrew
label: Hebrew
contentDir: content.he
languageDirection: rtl
direction: rtl
weight: 3
menu:
+1 -1
View File
@@ -1,4 +1,4 @@
[module]
[module.hugoVersion]
extended = true
min = "0.146.0"
min = "0.158.0"
+1 -1
View File
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="{{ .Site.Language.Lang }}">
<html lang="{{ .Site.Language.Name }}">
<head>
{{ partial "docs/html-head" . }}
{{ partial "docs/inject/head" . }}
+2 -2
View File
@@ -25,7 +25,7 @@ https://github.com/alex-shpak/hugo-book
<link rel="canonical" href="{{ .Permalink }}">
{{- range .Translations }}
<link rel="alternate" hreflang="{{ default .Site.LanguageCode .Language.Lang }}" href="{{ .Permalink }}" title="{{ partial "docs/title" . }}">
<link rel="alternate" hreflang="{{ default .Site.Language.Locale .Language.Name }}" href="{{ .Permalink }}" title="{{ partial "docs/title" . }}">
{{- end -}}
<!-- Theme stylesheet, you can customize scss by creating `assets/custom.scss` in your website -->
@@ -34,7 +34,7 @@ https://github.com/alex-shpak/hugo-book
<!-- Search -->
{{- if default true .Site.Params.BookSearch -}}
{{- $searchJSFile := printf "%s.search.js" .Language.Lang }}
{{- $searchJSFile := printf "%s.search.js" .Language.Name }}
{{- $searchJS := resources.Get "search.js" | resources.ExecuteAsTemplate $searchJSFile . | resources.Minify | resources.Fingerprint }}
<script defer src="{{ "fuse.min.js" | relURL }}"></script>
<script defer src="{{ partial "docs/links/resource-precache" $searchJS }}" {{ template "integrity" $searchJS }}></script>
+5 -5
View File
@@ -2,11 +2,11 @@
{{ $translations := dict }}
{{ if (eq $bookTranslatedOnly false ) }}
{{ range .Site.Home.Translations }}
{{ $translations = merge $translations (dict .Language.Lang .) }}
{{ $translations = merge $translations (dict .Language.Name .) }}
{{ end }}
{{ end }}
{{ range .Translations }}
{{ $translations = merge $translations (dict .Language.Lang .) }}
{{ $translations = merge $translations (dict .Language.Name .) }}
{{ end }}
<ul class="book-languages">
@@ -15,16 +15,16 @@
<label for="languages" class="flex">
<a role="button">
<img src="{{ partial "docs/icon" "translate" }}" class="book-icon" alt="{{ partial "docs/text/i18n" "Languages" }}" />
{{ $.Site.Language.LanguageName }}
{{ $.Site.Language.Label }}
</a>
<img src="{{ partial "docs/icon" "chevron-right" }}" class="book-icon" alt="{{ partial "docs/text/i18n" "Expand" }}" />
</label>
<ul>
{{ range .Site.Languages }}{{ with index $translations .Lang }}
{{ range .Site.Languages }}{{ with index $translations .Name }}
<li>
<a href="{{ cond hugo.IsMultihost .Permalink .RelPermalink }}" class="flex flex-auto">
{{ .Language.LanguageName }}
{{ .Language.Label }}
</a>
</li>
{{ end }}{{ end }}
+2 -2
View File
@@ -1,10 +1,10 @@
<!DOCTYPE html>
<html lang="{{ default .Site.Language.Lang .Site.LanguageCode }}" dir="{{ default "ltr" .Site.Language.LanguageDirection }}">
<html lang="{{ default .Site.Language.Name .Site.Language.Locale }}" dir="{{ default "ltr" .Site.Language.Direction }}">
<head>
{{ partial "docs/html-head" . }}
{{ partial "docs/inject/head" . }}
</head>
<body dir="{{ default "ltr" .Site.Language.LanguageDirection }}" class="book-kind-{{ .Kind }} book-type-{{ .Type }}{{ with .Layout }} book-layout-{{ . }}{{ end }}">
<body dir="{{ default "ltr" .Site.Language.Direction }}" class="book-kind-{{ .Kind }} book-type-{{ .Type }}{{ with .Layout }} book-layout-{{ . }}{{ end }}">
<input type="checkbox" class="hidden toggle" id="menu-control" />
<input type="checkbox" class="hidden toggle" id="toc-control" />
<main class="container flex">
+1 -1
View File
@@ -9,7 +9,7 @@ homepage = "https://github.com/alex-shpak/hugo-book"
demosite = "https://hugo-book-demo.netlify.app"
tags = ["responsive", "clean", "documentation", "docs", "flexbox", "search", "mobile", "multilingual", "disqus"]
features = []
min_version = "0.146.0"
min_version = "0.158.0"
[author]
name = "Alex Shpak"