I would like the RSS feed links on my site to include a title. I tried adding a feed link like this:
{{ with .OutputFormats.Get "RSS" }}
<link href="{{ .RelPermalink }}"
rel="alternate"
type="{{ .MediaType.Type }}"
title="{{ .Title }}">
{{ end }}
This fails with several errors along the lines of:
ERROR 2019/05/06 13:30:49 render of “section” failed: execute of template failed: template: post/list.html:1:3: executing “post/list.html” at <partial “header.html” .>: error calling partial: “/…/themes/ghostwriter/layouts/partials/header.html:30:24”: execute of template failed: template: partials/header.html:30:24: executing “partials/header.html” at <.Title>: can’t evaluate field Title in type *page.OutputFormat
I thought maybe this was just a question of .Title
being unset in some contest, so I tried this instead:
title="{{ .Title | default "" }}">
…but that resulted in the same errors. How do I get the page title into this link?