Martela RSS feed para mostrar pubDate de eventos

This commit is contained in:
Hugo Peixoto 2023-10-03 16:50:29 +01:00
parent 41689e4357
commit 2d44582e79
2 changed files with 7 additions and 0 deletions

View File

@ -80,6 +80,8 @@ privacy_pack = false
# Show related content at the bottom of pages?
show_related = {docs = true, page = false, post = true, project = true, publication = true, talk = true}
main_sections = ["noticias", "eventos"]
############################
## Contact details
##

View File

@ -2,6 +2,7 @@
{{- /* Upstream Hugo bug - RSS dates can be in future: https://github.com/gohugoio/hugo/issues/3918 */ -}}
{{- $page_context := cond .IsHome site . -}}
{{- $pages := $page_context.RegularPages -}}
{{- $pages = where $pages "Type" "in" site.Params.main_sections -}}
{{- $limit := site.Config.Services.RSS.Limit -}}
{{- if ge $limit 1 -}}
{{- $pages = $pages | first $limit -}}
@ -30,7 +31,11 @@
<item>
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>
{{- if eq .Type "noticias" }}
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
{{- else }}
<pubDate>{{ (time.AsTime .Params.metadata.event.date.start).Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
{{- end }}
<guid>{{ .Permalink }}</guid>
<description>{{ .Content | html }}</description>
</item>