Fix/hugo v0.158.0 deprecations (#1884)

* fix(layouts): use non-deprecated .Language methods

Hugo v0.158.0 deprecated these in favour of new names:
- .Language.LanguageDirection -> .Language.Direction
- .Language.LanguageCode -> .Language.Locale
- .Language.LanguageName -> .Language.Label

Fixes the deprecation warnings shown on every build. Requires Hugo
v0.158.0 or later.

Closes #1856

* chore(theme): bump minimum hugo version to v0.158.0

* fix(schema_json): replace deprecated .Language.Lang with .Language.Name

ref: https://discourse.gohugo.io/t/deprecations-in-v0-158-0/56869
This commit is contained in:
Aditya Telange authored and GitHub committed 2026-10-18 19:27:30 +05:30
1 parent d3768854d0
commit a5d59c7d44
10 files changed
+20 -20

No files matched your search

+2 -2
View File
@@ -39,8 +39,8 @@ body:
label: Hugo Version label: Hugo Version
description: What version of Hugo are you running? description: What version of Hugo are you running?
options: options:
- Hugo >= 0.146.0 (Recommended - Minimum version required for PaperMod) - Hugo >= 0.158.0 (Recommended - Minimum version required for PaperMod)
- Hugo < 0.146.0 (Incompatible - Not recommended to build PaperMod on lower versions) - Hugo < 0.158.0 (Incompatible - Not recommended to build PaperMod on lower versions)
validations: validations:
required: true required: true
- type: input - type: input
+2 -2
View File
@@ -23,7 +23,7 @@ on:
hugoVersion: hugoVersion:
description: "Hugo Version" description: "Hugo Version"
required: false required: false
default: "0.146.0" default: "0.158.0"
defaults: defaults:
run: run:
@@ -34,7 +34,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
# min_version from theme.toml # min_version from theme.toml
HUGO_VERSION: ${{ github.event.inputs.hugoVersion || '0.146.0' }} HUGO_VERSION: ${{ github.event.inputs.hugoVersion || '0.158.0' }}
steps: steps:
- name: Install Hugo CLI - name: Install Hugo CLI
run: | run: |
+1 -1
View File
@@ -3,7 +3,7 @@
**A fast, clean, and responsive theme for [Hugo](https://gohugo.io/).** **A fast, clean, and responsive theme for [Hugo](https://gohugo.io/).**
[![hugo-papermod](https://img.shields.io/badge/Hugo--Themes-@PaperMod-blue)](https://themes.gohugo.io/themes/hugo-papermod/) [![hugo-papermod](https://img.shields.io/badge/Hugo--Themes-@PaperMod-blue)](https://themes.gohugo.io/themes/hugo-papermod/)
[![Minimum Hugo Version](https://img.shields.io/static/v1?label=Hugo&message=v0.146.0%2B&color=blue&logo=hugo)](https://github.com/gohugoio/hugo/releases/tag/v0.146.0) [![Minimum Hugo Version](https://img.shields.io/static/v1?label=Hugo&message=v0.158.0%2B&color=blue&logo=hugo)](https://github.com/gohugoio/hugo/releases/tag/v0.158.0)
[![Discord](https://img.shields.io/discord/971046860317921340?label=Discord&logo=discord)](https://discord.gg/ahpmTvhVmp) [![Discord](https://img.shields.io/discord/971046860317921340?label=Discord&logo=discord)](https://discord.gg/ahpmTvhVmp)
> Based on [hugo-paper](https://github.com/nanxiaobei/hugo-paper/tree/4330c8b12aa48bfdecbcad6ad66145f679a430b3), with additional features and customization options. > Based on [hugo-paper](https://github.com/nanxiaobei/hugo-paper/tree/4330c8b12aa48bfdecbcad6ad66145f679a430b3), with additional features and customization options.
+4 -4
View File
@@ -67,10 +67,10 @@
{{- range . -}} {{- range . -}}
{{- if ne $lang .Lang }} {{- if ne $lang .Lang }}
<li> <li>
<a href="{{- .Permalink -}}" title="{{ .Language.Params.languageAltTitle | default (.Language.LanguageName | emojify) | default (.Lang | title) }}" <a href="{{- .Permalink -}}" title="{{ .Language.Params.languageAltTitle | default (.Language.Label | emojify) | default (.Lang | title) }}"
aria-label="{{ .Language.LanguageName | default (.Lang | title) }}"> aria-label="{{ .Language.Label | default (.Lang | title) }}">
{{- if (and site.Params.displayFullLangName (.Language.LanguageName)) }} {{- if (and site.Params.displayFullLangName (.Language.Label)) }}
{{- .Language.LanguageName | emojify -}} {{- .Language.Label | emojify -}}
{{- else }} {{- else }}
{{- .Lang | title -}} {{- .Lang | title -}}
{{- end -}} {{- end -}}
+1 -1
View File
@@ -12,7 +12,7 @@
<meta property="og:description" content="{{ trim . "\n\r\t " }}"> <meta property="og:description" content="{{ trim . "\n\r\t " }}">
{{- end }} {{- end }}
{{- with or .Params.locale site.Language.LanguageCode }} {{- with or .Params.locale site.Language.Locale }}
<meta property="og:locale" content="{{ replace . `-` `_` }}"> <meta property="og:locale" content="{{ replace . `-` `_` }}">
{{- end }} {{- end }}
+1 -1
View File
@@ -76,7 +76,7 @@
], ],
"articleBody": {{ .Content | safeJS | htmlUnescape | plainify }}, "articleBody": {{ .Content | safeJS | htmlUnescape | plainify }},
"wordCount" : "{{ .WordCount }}", "wordCount" : "{{ .WordCount }}",
"inLanguage": {{ .Language.Lang | default "en-us" }}, "inLanguage": {{ .Language.Name | default "en-us" }},
{{ if .Params.cover.image -}} {{ if .Params.cover.image -}}
"image": "image":
{{- if (ne .Params.cover.relative true) -}} {{- if (ne .Params.cover.relative true) -}}
+2 -2
View File
@@ -9,8 +9,8 @@
{{- range .Translations }} {{- range .Translations }}
<li> <li>
<a href="{{ .Permalink }}"> <a href="{{ .Permalink }}">
{{- if (and site.Params.displayFullLangName (.Language.LanguageName)) }} {{- if (and site.Params.displayFullLangName (.Language.Label)) }}
{{- .Language.LanguageName | emojify -}} {{- .Language.Label | emojify -}}
{{- else }} {{- else }}
{{- .Lang | title -}} {{- .Lang | title -}}
{{- end -}} {{- end -}}
+5 -5
View File
@@ -1,15 +1,15 @@
{{- if lt hugo.Version "0.146.0" }} {{- if lt hugo.Version "0.158.0" }}
{{- errorf "=> hugo v0.146.0 or greater is required for hugo-PaperMod to build " }} {{- errorf "=> hugo v0.158.0 or greater is required for hugo-PaperMod to build " }}
{{- end -}} {{- end -}}
<!DOCTYPE html> <!DOCTYPE html>
{{- $theme := site.Params.defaultTheme | default "auto" }} {{- $theme := site.Params.defaultTheme | default "auto" }}
{{- if eq $theme "dark" }} {{- if eq $theme "dark" }}
<html lang="{{ site.Language }}" dir="{{ .Language.LanguageDirection | default "auto" }}" data-theme="dark"> <html lang="{{ site.Language }}" dir="{{ .Language.Direction | default "auto" }}" data-theme="dark">
{{- else if eq $theme "light" }} {{- else if eq $theme "light" }}
<html lang="{{ site.Language }}" dir="{{ .Language.LanguageDirection | default "auto" }}" data-theme="light"> <html lang="{{ site.Language }}" dir="{{ .Language.Direction | default "auto" }}" data-theme="light">
{{- else }} {{- else }}
<html lang="{{ site.Language }}" dir="{{ .Language.LanguageDirection | default "auto" }}" data-theme="auto"> <html lang="{{ site.Language }}" dir="{{ .Language.Direction | default "auto" }}" data-theme="auto">
{{- end }} {{- end }}
<head> <head>
+1 -1
View File
@@ -45,7 +45,7 @@
</image> </image>
{{- end }} {{- end }}
<generator>Hugo</generator> <generator>Hugo</generator>
<language>{{ site.Language.LanguageCode }}</language>{{ with $authorEmail }} <language>{{ site.Language.Locale }}</language>{{ with $authorEmail }}
<managingEditor>{{.}}{{ with $authorName }} ({{ . }}){{ end }}</managingEditor>{{ end }}{{ with $authorEmail }} <managingEditor>{{.}}{{ with $authorName }} ({{ . }}){{ end }}</managingEditor>{{ end }}{{ with $authorEmail }}
<webMaster>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</webMaster>{{ end }}{{ with site.Copyright }} <webMaster>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</webMaster>{{ end }}{{ with site.Copyright }}
<copyright>{{ . | markdownify | plainify | strings.TrimPrefix "© " }}</copyright>{{ end }}{{ if not .Date.IsZero }} <copyright>{{ . | markdownify | plainify | strings.TrimPrefix "© " }}</copyright>{{ end }}{{ if not .Date.IsZero }}
+1 -1
View File
@@ -54,7 +54,7 @@ features = [
"multiple-authors", "multiple-authors",
"post-nav-links" "post-nav-links"
] ]
min_version = "0.146.0" min_version = "0.158.0"
[author] [author]
name = "Aditya Telange" name = "Aditya Telange"