mirror of https://github.com/lxndrblz/anatole.git

koh-sh
yesterday 92946d0c39dd5a27ff8c9a403a4f2f3cc2d5ab4a
fix: resolve .Site.Author error for Hugo 0.156.0 (#583)

* fix: resolve .Site.Author error for Hugo 0.156.0
* feat: add reflect.IsMap handling for author in all templates
* chore: update hugo and sass to latest version

---------

Co-authored-by: Alexander Bilz <mail@alexbilz.com>
6 files modified
75 ■■■■ changed files
.devcontainer/Dockerfile 4 ●●●● patch | view | raw | blame | history
layouts/_default/rss.xml 28 ●●●● patch | view | raw | blame | history
layouts/partials/footer.html 12 ●●●●● patch | view | raw | blame | history
layouts/partials/head.html 16 ●●●● patch | view | raw | blame | history
layouts/partials/schema.html 11 ●●●●● patch | view | raw | blame | history
netlify.toml 4 ●●●● patch | view | raw | blame | history
.devcontainer/Dockerfile
@@ -5,9 +5,9 @@
# VARIANT can be either 'hugo' for the standard version or 'hugo_extended' for the extended version.
ARG VARIANT=hugo_extended
# VERSION can be either 'latest' or a specific version number
ARG HUGO_VERSION="0.147.8"
ARG HUGO_VERSION="0.157.0"
ARG DART_SASS_VERSION="1.89.2"
ARG DART_SASS_VERSION="1.97.3"
# Download Hugo
RUN apt-get update && apt-get install -y ca-certificates openssl git curl && \
layouts/_default/rss.xml
@@ -1,3 +1,21 @@
{{- $authorEmail := "" -}}
{{- with site.Params.author -}}
  {{- if reflect.IsMap . -}}
    {{- with .email -}}
      {{- $authorEmail = . -}}
    {{- end -}}
  {{- end -}}
{{- end -}}
{{- $authorName := "" -}}
{{- with site.Params.author -}}
  {{- if reflect.IsMap . -}}
    {{- with .name -}}
      {{- $authorName = . -}}
    {{- end -}}
  {{- else -}}
    {{- $authorName = . -}}
  {{- end -}}
{{- end -}}
{{- $pctx := . -}}
{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
{{- $pages := slice -}}
@@ -17,9 +35,9 @@
    <link>{{ .Permalink }}</link>
    <description>Recent content {{ if ne  .Title  .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description>
    <generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }}
    <language>{{.}}</language>{{end}}{{ with .Site.Author.email }}
    <managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }}
    <webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
    <language>{{.}}</language>{{end}}{{ with $authorEmail }}
    <managingEditor>{{.}}{{ with $authorName }} ({{.}}){{end}}</managingEditor>{{end}}{{ with $authorEmail }}
    <webMaster>{{.}}{{ with $authorName }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
    <copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
    <lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
    {{- with .OutputFormats.Get "RSS" -}}
@@ -30,7 +48,7 @@
      <title>{{ .Title }}</title>
      <link>{{ .Permalink }}</link>
      <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
      {{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}}
      {{ with $authorEmail }}<author>{{.}}{{ with $authorName }} ({{.}}){{end}}</author>{{end}}
      <guid>{{ .Permalink }}</guid>
      {{ if eq .Site.Params.rssFullContent true }}
        <description>{{ .Content | html }}</description>
@@ -42,4 +60,4 @@
    </item>
    {{ end }}
  </channel>
</rss>
</rss>
layouts/partials/footer.html
@@ -1,3 +1,13 @@
{{- $authorName := "" -}}
{{- with .context.Site.Params.author -}}
  {{- if reflect.IsMap . -}}
    {{- with .name -}}
      {{- $authorName = . -}}
    {{- end -}}
  {{- else -}}
    {{- $authorName = . -}}
  {{- end -}}
{{- end -}}
<footer class="footer footer__{{ .footerClassModifier }}">
  <ul class="footer__list">
    <li class="footer__item">
@@ -5,7 +15,7 @@
      {{ if isset .context.Site.Params "copyright" }}
        {{ replace .context.Site.Params.copyright "{{ YEAR }}" (now.Format "2006") | markdownify }}
      {{ else }}
        {{ .context.Site.Params.author }}
        {{ $authorName }}
        {{ now.Format "2006" }}
      {{ end }}
    </li>
layouts/partials/head.html
@@ -1,13 +1,23 @@
<head>
  <meta charset="utf-8" />
  {{- $authorName := "" -}}
  {{- with .Site.Params.author -}}
    {{- if reflect.IsMap . -}}
      {{- with .name -}}
        {{- $authorName = . -}}
      {{- end -}}
    {{- else -}}
      {{- $authorName = . -}}
    {{- end -}}
  {{- end -}}
  <title>
    {{ if (eq .Site.Params.reversepagetitle true) }}
      {{ with .Title }}
        {{ . }} |
      {{ end }}
      {{- .Site.Params.author -}}
      {{- $authorName -}}
    {{ else }}
      {{- .Site.Params.author -}}{{ with .Title }}
      {{- $authorName -}}{{ with .Title }}
        |
        {{ . }}
      {{ end }}
@@ -19,7 +29,7 @@
  <!-- Meta -->
  {{- hugo.Generator -}}
  <meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover" />
  <meta name="author" content="{{ .Site.Params.author }}" />
  <meta name="author" content="{{ $authorName }}" />
  <meta
    name="description"
    content="{{ if .Params.description }}
layouts/partials/schema.html
@@ -15,7 +15,16 @@
    }
  </script>
{{ else if .IsPage }}
  {{ $author :=  or (.Params.author) (.Site.Params.author) }}
  {{- $author := "" -}}
  {{- with or (.Params.author) (.Site.Params.author) -}}
    {{- if reflect.IsMap . -}}
      {{- with .name -}}
        {{- $author = . -}}
      {{- end -}}
    {{- else -}}
      {{- $author = . -}}
    {{- end -}}
  {{- end -}}
  {{ $favicon := .Site.Params.favicon | absURL }}
  <script type="application/ld+json">
    {
netlify.toml
@@ -10,8 +10,8 @@
  """
[build.environment]
  HUGO_VERSION = "0.147.8"
  DART_SASS_VERSION = "1.89.2"
  HUGO_VERSION = "0.157.0"
  DART_SASS_VERSION = "1.97.3"
  NODE_VERSION = "22"
  GO_VERSION = "1.24.3"
  HUGO_ENV = "production"