How to set up footer links with proper rel attributes and targets?

I’ve spent most of the day trying to get a decent footer menu structure going. So far only the most basic attributes work.

As far as RTFM, looking through Menu Entry Properties | Hugo wasn’t any help with this issue.

in the menu.en.toml I have tables like this:

[[connect]]
  name = "Newsletter"
  url = "https://frankjonen.substack.com"
  rel = "external"
  title = "The Smithereenery - On Substack"
  weight = 20
  target = "_blank"

Yet as soon as I go beyond

{{ range .Site.Menus.connect -}}
  <li><a href="{{ .URL }}" title="{{ .Title }}">{{ .Name }}</a></li>
{{ end }}

it blows up in my face. Neither {{ .Rel }} nor {{ .Params.rel }} will render. How am I supposed to get to these values?

Been there done that, doesn’t work.

[[connect]]
  name = "Twitter"
  url = "https://twitter.com/frankjonen"
  rel = "external"
  title = "The Smithereenery - On Substack"
  weight = 20
  [connect.params]
    rel = "external"
{{ range .Site.Menus.connect -}}
  <li><a href="{{ .URL }}" rel"{{ .Params.rel }}" title="{{ .Title }}">{{ .Name }}</a></li>
{{ end }}

blows up as:

execute of template failed at <partial "footer/footer.html" .>: error calling partial: execute of template failed: html/template:partials/footer/footer.html: "\"" in attribute name: " rel\""

you need an = sign here.

1 Like

Gahhh! I’m becoming blind to this footer section. Thanks for the catch. Got it working now!
Phew. One less thing to worry about.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.