diff --git a/layouts/rss.xml b/layouts/rss.xml index 01b2468..a7a9210 100644 --- a/layouts/rss.xml +++ b/layouts/rss.xml @@ -30,6 +30,9 @@ {{- end }} {{- end }} +{{- /* Define allowed sections for RSS feed */}} +{{- $allowedSections := slice "blog" "collection" "livres" "recettes" }} + {{- $pctx := . }} {{- if .IsHome }}{{ $pctx = site }}{{ end }} {{- $pages := slice }} @@ -66,16 +69,29 @@ {{- end }} {{- range $pages }} {{- $section := .Section }} - {{- if and (ne .Layout `search`) (ne .Layout `archives`) (ne $section `a-propos`) (ne $section `blogroll`) (ne $section `contact`) (ne $section `colophon`) }} + {{- if in $allowedSections $section }} {{ .Title }} {{ .Permalink }} {{ .PublishDate.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} {{- with $authorEmail }}{{ . }}{{ with $authorName }} ({{ . }}){{ end }}{{ end }} {{ .Permalink }} - {{ with .Description | html }}{{ . }}{{ else }}{{ .Summary | html }}{{ end -}} - {{- if and site.Params.ShowFullTextinRSS .Content }} - {{ (printf "" .Content) | safeHTML }} + + {{- /* Process content to fix image URLs */}} + {{- $summary := "" }} + {{- with .Description }} + {{- $summary = . }} + {{- else }} + {{- $summary = .Summary }} + {{- end }} + + {{- $baseURLWithoutTrailing := strings.TrimSuffix "/" site.BaseURL }} + {{ $summary | html }} + + {{- if site.Params.ShowFullTextinRSS }} + {{- $content := .Content }} + {{- $content := $content | replaceRE `src="(/[^"]*)"` (printf `src="%s$1"` $baseURLWithoutTrailing) }} + {{ (printf "" $content) | safeHTML }} {{- end }} {{- end }}