Error: can't evaluate field title in type interface {}


#1

Hello, I have in my config following:
[params.mainpage]
[[params.mainpage.hero]]
title = “Ttile”

In index.html template I call it like this:
<h1>{{ with .Site.Params.mainpage.hero.title }}{{ . | markdownify }}{{ end }}</h1>

Error while rendering “home”: template: theme/index.html:19:68: executing “theme/index.html” at <.Site.Params.mainpag…>: can’t evaluate field title in type interface {}


#2

There isn’t enough info in your posts for other than wild guesses.


#3

Sorry, forget to show how I call it.
In index.html template I call it like this:
<h1>{{ with .Site.Params.mainpage.hero.title }}{{ . | markdownify }}{{ end }}</h1>


#4

You need to get the params path correct: .Site.Params.mainpage.hero.title


#5

Oh, sorry, my bad.
I use it like you say.

.Site.Params.hero.title work ok(if change config essentially)
but
.Site.Params.mainpage.hero.title don`t


#6

Why do you have double []s around params.mainpage.hero?