Unable to get a rel=alternate link in my header

I’m not entirely sure what I’m doing wrong, but it’s probably trivial:

I generate RSS feeds for my posts and taxonomies:

[outputs]
    home = ["html", "rss"]

[outputFormats]
    [outputFormats.RSS]
        mediatype = 'application/rss'
        baseName = 'feed'

A number of feed.xml files is generated, so that works. However, I also want to have a rel=alternate link in my header, and I don’t exactly know how, but I tried this:

{{ with .OutputFormats.Get "rss" -}}
  {{ printf `<link rel=%q type=%q href=%q title=%q>` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
{{ end }}

Alas, the resulting HTML does not contain any RSS link. What am I doing wrong?

Works for me…

git clone --single-branch -b hugo-forum-topic-52453 https://github.com/jmooring/hugo-testing hugo-forum-topic-52453
cd hugo-forum-topic-52453
hugo
head public/index.html

I’m happy to hear that, but it does not solve my problem, does it?

Perhaps what you meant to say was, “Thank you for spending some of your free time looking into my issue this weekend.”

You can either compare what you have done with the working example I provided, or provide a link to a repository that reliably reproduces your problem.

2 Likes

I admit that was unnecessarily harsh. I’m a professional developer, and ‘it works for me’ is something you really don’t like to hear - I apologise.

But yes, it solved my problem: apparently Hugo distinguishes between ‘RSS’ and ‘rss’…

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