Template changed “/home/stoned/websites/websites/psychedelicsdaily.com-hugo/themes/hugo-universal-theme/layouts/partials/css.html”: CREATE
ERROR 2018/02/09 10:18:46 Error while rendering “taxonomyTerm” in “”: template: theme/_default/list.html:49:45: executing “theme/_default/list.html” at <index .Site.Params.a…>: error calling index: value is nil; should be of type string
Is the error I get. This is the line in question: {{$author := index .Site.Params.authors (.Params.author) }}
This only started to happen after I upgraded my Hugo. I forgot what the older version was.
config.toml has
author=authors as taxonomy
Article front matter has
+++
author="hash"
authors="hash-borgir"
+++
and the config.toml file has
[params.authors.hash]
{{$author := index .Site.Params.authors (.Params.author)}}
works in single.html (single page template), but when in list.html, it gives an error.
Could it be that single.html can read the article front matter, in which .Params.author is defined as front matter author=“hash” cannot?
I’m guessing list.html template pages can’t read article front matter of pages? I’ve tried something like:
{{ range .Data.Pages }}
{{$author := index .Site.Params.authors (.Params.author)}}
{{ end }}
and that still gives me the error.
That code giving the error: <index .Site.Params.a...>: error calling index: value is nil; should be of type string
basically expects (.Params.author)
to be a thing, which it is not, hence the nil error.
.Site.Params.authors
defines an array of authors. Article front matter author=""
bit (.Params.author)
is the actual author in the .Site.Params.authors array.
How can I make list template pages get access to .Params.author
?
Note: This only gives an error in Hugo logs, but actually continues to function… for some odd reason.
If you go to hash-borgir - Using Psychedelics Daily for a happy & healthy life or Dimethyltryptamine (DMT) - Using Psychedelics Daily for a happy & healthy life you’ll see the list pages, and how each author is properly functioning, but I still get this error, and I’d like to not have this error anymore.
Let me know what else I can help you to do understand my problem. Please advise, guys.
Sincerely,
Hash B.