7
1
mirror of https://gitlab.com/ansol/web-ansol.org.git synced 2024-11-21 22:01:31 +00:00

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 content at the bottom of pages?
show_related = {docs = true, page = false, post = true, project = true, publication = true, talk = true} show_related = {docs = true, page = false, post = true, project = true, publication = true, talk = true}
main_sections = ["noticias", "eventos"]
############################ ############################
## Contact details ## Contact details
## ##

View File

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