Removing graphs from RSS feed

This commit is contained in:
Dan 2026-01-13 18:09:32 +00:00
parent d289809cd1
commit 3eab65c59b

View file

@ -6,7 +6,6 @@
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- $authorName := "" }} {{- $authorName := "" }}
{{- with site.Params.author }} {{- with site.Params.author }}
{{- if reflect.IsMap . }} {{- if reflect.IsMap . }}
@ -17,7 +16,6 @@
{{- $authorName = . }} {{- $authorName = . }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- $pctx := . }} {{- $pctx := . }}
{{- if .IsHome }}{{ $pctx = .Site }}{{ end }} {{- if .IsHome }}{{ $pctx = .Site }}{{ end }}
{{- $pages := slice }} {{- $pages := slice }}
@ -32,24 +30,27 @@
{{- end }} {{- end }}
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }} {{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel> <channel>
<title>Blog(gish) by Dan @ ritual.sh</title> <title>Blog(gish) by Dan @ ritual.sh</title>
<link>{{ .Permalink }}</link> <link>{{ .Permalink }}</link>
<description>Dan's thoughts on web and game development, tech experiments, and whatever else catches my attention in the Golden Valley.</description> <description>Dan's thoughts on web and game development, tech experiments, and whatever else catches my attention in the Golden Valley.</description>
<language>{{ site.Language.LanguageCode }}</language>{{ if not .Date.IsZero }} <language>{{ site.Language.LanguageCode }}</language>{{ if not .Date.IsZero }}
<lastBuildDate>{{ (index $pages.ByLastmod.Reverse 0).Lastmod.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }} <lastBuildDate>{{ (index $pages.ByLastmod.Reverse 0).Lastmod.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
{{- with .OutputFormats.Get "RSS" }} {{- with .OutputFormats.Get "RSS" }}
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }} {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{- end }} {{- end }}
{{- range $pages }} {{- range $pages }}
<item> {{- $content := .Content }}
<title>{{ .Title }}</title> {{- /* Remove graph containers with all their content including canvas and script tags */ -}}
<link>{{ .Permalink }}</link> {{- $content = replaceRE `(?s)<div class="graph-container"[^>]*>.*?</div>\s*<script>.*?</script>` "<p><em>[Interactive graph not available in RSS - please visit the full post to view the charts]</em></p>" $content }}
<pubDate>{{ .PublishDate.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> <item>
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>
<pubDate>{{ .PublishDate.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
{{- with $authorEmail }}<author>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</author>{{ end }} {{- with $authorEmail }}<author>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</author>{{ end }}
<guid>{{ .Permalink }}</guid> <guid>{{ .Permalink }}</guid>
<description>{{ .Content | transform.XMLEscape | safeHTML }}</description> <description>{{ $content | transform.XMLEscape }}</description>
</item> </item>
{{- end }} {{- end }}
</channel> </channel>
</rss> </rss>