Trying to mod a theme and struggling with variables

What I’m trying to do is at target="_blank" as an option to the theme

current setup config

  [[menu.postpend]]
    url = "https://www.facebook.com/blah"
    name = "Reviews"
    weight = 9

relevant bit of nav partial

 {{ range .Site.Menus.postpend }}
            <li>
                <a href="{{ .URL | safeURL }}" >{{ .Name | markdownify }}</a>
            </li>
  {{ end }}

So my proposed change is

[[menu.postpend]]
    url = "https://www.facebook.com/blah"
    name = "Reviews"
    target = "_blank"
    weight = 9

and

 {{ range .Site.Menus.postpend }}
            <li>
                <a href="{{ .URL | safeURL }}"  {{ with .target}} target="{{ .target }}" {{ end }}>{{ .Name | markdownify }}</a>
            </li>
  {{ end }}

To me this looks good BUT it doesn’t work

infact when I do this to investigate

{{ range .Site.Menus.postpend }}
            <li>
               {{ . }}
                <a href="{{ .URL | safeURL }}"  {{ with .target}} target="{{ .target }}" {{ end }}>{{ .Name | markdownify }}</a>
            </li>
  {{ end }}

I get

 {https://www.facebook.com/blah Reviews postpend 9 []}

the value for target does not appear

I’n relatively noob - what am I missing?

OK I’ve got it

This element is using Site.menus which has a limited variable structure.

The theme Author had used Site.Params to define other elements - which would allow additional variables. Now to read more to find out why Menus is used specifically you for extension.

I’ll work it out.

Thanks for looking

1 Like