{{/* /// Copyright (C) 2026 Andre Franca /// /// This program is free software: you can redistribute it and/or modify /// it under the terms of the GNU Affero General Public License as published by /// the Free Software Foundation, either version 3 of the License, or /// (at your option) any later version. /// /// This program is distributed in the hope that it will be useful, /// but WITHOUT ANY WARRANTY; without even the implied warranty of /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /// GNU Affero General Public License for more details. /// /// You should have received a copy of the GNU Affero General Public License /// along with this program. If not, see . /// */}} {{- $authorName := site.Params.author.name | default site.Title -}} {{- $authorEmail := site.Params.author.email | default "" -}} {{- $pages := slice -}} {{- with site.GetPage "/posts" -}} {{- $pages = union $pages .RegularPagesRecursive -}} {{- end -}} {{- with site.GetPage "/rss-only" -}} {{- $pages = union $pages .RegularPagesRecursive -}} {{- end -}} {{- $pages = sort $pages "Date" "desc" -}} {{- $limit := .Site.Config.Services.RSS.Limit -}} {{- if ge $limit 1 -}} {{- $pages = first $limit $pages -}} {{- end -}} {{- $feedUpdated := now -}} {{- $updatedPages := sort $pages "Lastmod" "desc" -}} {{- if gt (len $updatedPages) 0 -}} {{- $feedUpdated = (index $updatedPages 0).Lastmod -}} {{- end -}} {{- printf "\n" | safeHTML -}} {{- printf "\n" ("/xsl/atom.xsl" | absURL) | safeHTML -}} {{ .Permalink }} {{ .Site.Title }} {{ $feedUpdated.Format "2006-01-02T15:04:05Z07:00" }} {{- with .OutputFormats.Get "atom" }} {{- end }} {{ $authorName }} {{- with $authorEmail }} {{ . }} {{- end }} {{- range $pages }} {{ .Permalink }} {{ .Title }} {{ .PublishDate.Format "2006-01-02T15:04:05Z07:00" }} {{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }} {{- with .Params.tags }} {{- range . }} {{- end }} {{- end }} {{- with .Summary }} {{ . | plainify | transform.XMLEscape | safeHTML }} {{- end }} {{- $entry := . -}} {{- $entryContent := .Content -}} {{- $contactLinks := slice -}} {{- with site.Params.contactEmail -}} {{- $subject := printf "Re: %s" $entry.Title | urlquery -}} {{- $body := printf "Regarding your post: %s\n\n" $entry.Permalink | urlquery -}} {{- $contactLinks = $contactLinks | append (printf `email` . $subject $body) -}} {{- end -}} {{- with site.Params.fediverseURL -}} {{- $contactLinks = $contactLinks | append (printf `mastodon` .) -}} {{- end -}} {{- with site.Params.webmentionEndpoint -}} {{- $contactLinks = $contactLinks | append (printf `webmention` .) -}} {{- end -}} {{- $n := len $contactLinks -}} {{- if gt $n 0 -}} {{- $linksText := "" -}} {{- if eq $n 1 -}} {{- $linksText = index $contactLinks 0 -}} {{- else if eq $n 2 -}} {{- $linksText = delimit $contactLinks " or " -}} {{- else -}} {{- $linksText = printf "%s, or %s" (delimit (first (sub $n 1) $contactLinks) ", ") (index $contactLinks (sub $n 1)) -}} {{- end -}} {{- $entryContent = printf `%s

Questions, comments, or feedbacks? Feel free to reach out by %s.

` $entryContent $linksText -}} {{- end }} {{- $baseURL := strings.TrimSuffix "/" site.BaseURL -}} {{- $entryContent = replace $entryContent "src=\"/" (printf "src=\"%s/" $baseURL) -}} {{- $entryContent = replace $entryContent "src='/'" (printf "src='%s/" $baseURL) -}} {{ $entryContent | transform.XMLEscape | safeHTML }}
{{- end }}