I’m trying to have the main rss feed located in /index.xml to ouput all the available languages.
So far the code I have is this:
{{ range first 50 (where (where .Data.Pages ".Params.options" "!=" nil) ".Params.options.unlisted" "!=" true) }}
Only recently did I noticed that localhost/index.xml only returns the default version. If I want the Portuguese content I need to visit localhost/pt/index.xml.
Is it possible to have the following behaviour?
localhost/en/index.xml => English feed
localhost/pt/index.xml => Portuguese Feed
localhost/index.xml => PT + EN feed
If not, how can I include both languages in the range? I thought it was enough to replace .Data with .Site, but I was wrong.
Hi All,
I have raised a proposal for this and as I try to find a temporary solution, when somebody put main URL into RSS reader (like Feedly) they will be suggested not only for main url RSS feed but also for any translated there, I come out with this:
{{- with .Site.GetPage "/" }} <!-- Because I want RSS in header on every page -->
{{ with .OutputFormats.Get "rss" -}}
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
{{ end -}}
{{ range .Translations }} <!-- If other languages present output RSS for them as well -->
{{- $titleLang := .Title }}
{{ with .OutputFormats.Get "rss" -}}
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $titleLang | safeHTML }}
{{ end -}}
{{ end }}
{{- end }}
Sharing here in case somebody will not look through GitHub.