Hugo

Taxonomies issue since Hugo 0.57.0/0.57.1

Hello Hugo users,

since Hugo 0.57.0/0.57.1 I’m having problemes with rendering taxonomies in my custom rss.xml file. Here is the whole error message:

execute of template failed: template: _default/rss.xml:24:49: executing "_default/rss.xml" at <index .Params.publication_types 0>: error calling index: index of untyped nil

The taxonomies related section in my config.toml:

[params]
  publication_types = [
'Sonstiges',  # 0
'Conference proceedings',  # 1
'Beiträge in Zeitschriften',  # 2
'Work in progress',  # 3
'Technical report',  # 4
'Monografien und Sammelbände',  # 5
'Beiträge in Sammelbänden',  # 6
'Poster', # 7
'Rezensionen', # 8
'Vorträge' # 9
  ]

[taxonomies]
publication_type = "publication_types"

My custom rss.xml in layouts/_default/:

<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel>
<title>{{ .Site.Title }}</title>
<description>Publikationen und Vorträge von {{ $.Site.Params.name }}</description>
<link>{{ .Permalink }}</link>
<image>
  <url>{{ .Permalink }}img/icon.png</url>
  <title>{{ .Site.Title }}</title>
  <link>{{ .Permalink }}</link>
</image>
<generator>Hugo {{ hugo.Version }}</generator>{{ with .Site.LanguageCode }}
<language>{{.}}</language>{{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" }}
    {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{ end }}
{{ range where .Data.Pages "Section" "in" (slice "publikationen" "vortraege") }}
<item>
  <title>{{ .Title }} ({{ range $index, $pubtype := .Params.publication_types }}{{ index $.Site.Params.publication_types (int .) }}{{ end }})</title>
  {{ if in .Params.publication_types "9" }}
  <link>{{ .Site.BaseURL }}vortraege/#{{ index .Params.publication_types 0 }}</link>
  {{ else }}
  <link>{{ .Site.BaseURL }}publikationen/#{{ index .Params.publication_types 0 }}</link>
  {{ end }}
  <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
  <guid>{{ .Permalink }}</guid>
  {{ if in .Params.publication_types "9" }}
    <description>{{ .Date.Format "02.01.2006" }} – {{ .Title }}. {{ .Params.event }}, {{ .Params.location }}</description>
  {{ else }}
    <description>{{ with .Params.authors }}{{ delimit . "; " }}{{ end }} ({{ .Date.Format "2006" }}{{ range .Params.pub_status }}, {{ .name }}{{ end }}): {{ .Title }}. {{ .Params.publication }}{{ with .Params.publication }}{{ print ". " }}{{ end }}</description>
  {{ end }}
</item>
{{ end }}

And an exemplary .md file from the folder publikationen:

+++
title = "My title"
date = "2020-01-01"
authors = ["Author 1","Author 2"]
publication_types = ["6"]
publication = "Full journal"
+++

Many thanks for any suggestions!

If the array publication_types is in config.toml shouldn’t you be referencing it as .Site.Params.publication_types?

Thank you for your reply, @funkydan2! But version 0.57.2 recently brought the solution. The error was caused by a breaking change, which is mentioned here. So, replacing .Data.Pages with .Site.RegularPages in file rss.xml fixed my issue!