RSS link "type" in menu

Hi - in config.toml, we can specify an RSS link like this:

[[menu.social]]
    pre = "<i class='fa fa-rss'></i>"
    url = "/index.xml"
    identifier = "rss"
    weight = 12

But RSS links are meant to have a type specified: type="application/rss+xml".

If I’m missing how to do this already, please advise, but would it be possible to get the ability to specify link type in a menu entry?

I guess no one thought about it, until know …

But it is you, the template writer, who construct the link, so doing a if identifier == rss then set type=“application/rss+xml” sounds doable.

We could add type that defaults to text/html… But then it has to get into a issue at GitHub …

1 Like

Oh yes, I see I can probably nest an if statement into my template for this. I’ll try it!

Ok, cool, this seems to be working:

{{ if .Site.Menus.social }}
<div class="social-buttons">
  {{ range .Site.Menus.social.ByWeight }}
    {{ if .URL }}
      {{ if eq .Identifier "rss"}}
      <a href="{{ .URL }}" type="application/rss+xml" target="_blank">{{ .Pre }}</a>
      {{ else }}
      <a href="{{ .URL }}" target="_blank">{{ .Pre }}</a>
      {{ end }}
    {{ end }}
  {{ end }}
</div>
{{ end }}

@bjornerik thanks for the nudge in the right direction!