[SOLVED] Outputting params from language block

I’ve been busting my head and can’t get around this.

This is what I have on my config.toml and I am trying to output the value of headline with {{ .Site.Language.Params.headline }} which keeps outputting blank. If I do try {{ .Site.Language.Params }} I do see the value there.

What am I doing wrong?

weight = 1
LanguageName = "English"

headline = "Tales of an hyperactive geek"

name = "About"
url = "/about/blog"
weight = 1
post = "This is more than meets the eye"

weight = 2
LanguageName = "Portuguese"

headline = "Contos de uma mente hiperactiva"

	name = "Sobre"
	url = "/about/blog"
	weight = 1
	post = "Isto é mais do que um blog"

Shouldn’t it be {{ $.Site.Languages.en.params.headline }} and
{{ $.Site.Languages.pt.params.headline }} ?

I can’t find it right now, but somewhere in the docs there was a mention of just .Site.Language.Params and that does return a map of the string defined in config.toml.

It works both ways with or without the $.

But the problem is that you are missing the .en. and .pt. parts of your headlines parameters. So it’s normal to have blank output. You need to use the exact naming you specified in your config to access these parameters.

That format returns an error saying <$.Site.Languages.en....>: can't evaluate field en in type helpers.Languages

Just for reference, in the end some changes to config.toml seemed to work:

weight = 2
LanguageName = "Portuguese"
subtitle = "Contos de uma mente hiperactiva"

and in the template:

	<p>{{ .Site.Params.subtitle }}</p>

This however seems to contradict what is in the docs: https://gohugo.io/content-management/multilingual/#configure-languages

This would work only for global params, not per language I suppose.

I am having the same issue


	editGH = "Edit"
	print = "Print"
	return = "Return"
	copyright = "Copyright"


		edit = "EditES"
		print = "PrintES"
		return = "ReturnES"
		copyright = "CopyrightES"

Then in my template {{ .Site.Language.Params.return }} is empty and {{ .Site.Language.Params}} returns a map (exactly the same as you have described it).

EDIT: the solution is {{ .Site.Language.Params.params.yourParamValue }}. Maybe something to consider for docs improvement :slight_smile: