From 2d44582e7976a8b9ea16e634ee4570b2e7551e55 Mon Sep 17 00:00:00 2001 From: Hugo Peixoto Date: Tue, 3 Oct 2023 16:50:29 +0100 Subject: [PATCH] Martela RSS feed para mostrar pubDate de eventos --- config/_default/params.toml | 2 ++ themes/academic/layouts/_default/rss.xml | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/config/_default/params.toml b/config/_default/params.toml index d4b48aa..e7ac3f2 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -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 ## diff --git a/themes/academic/layouts/_default/rss.xml b/themes/academic/layouts/_default/rss.xml index 38086bc..bd9c244 100644 --- a/themes/academic/layouts/_default/rss.xml +++ b/themes/academic/layouts/_default/rss.xml @@ -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 @@ {{ .Title }} {{ .Permalink }} + {{- if eq .Type "noticias" }} {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} + {{- else }} + {{ (time.AsTime .Params.metadata.event.date.start).Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} + {{- end }} {{ .Permalink }} {{ .Content | html }}