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 }}
{{- $authorName := "" }}
{{- with site.Params.author }}
{{- if reflect.IsMap . }}
@ -17,7 +16,6 @@
{{- $authorName = . }}
{{- end }}
{{- end }}
{{- $pctx := . }}
{{- if .IsHome }}{{ $pctx = .Site }}{{ end }}
{{- $pages := slice }}
@ -32,24 +30,27 @@
{{- end }}
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Blog(gish) by Dan @ ritual.sh</title>
<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>
<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 }}
<channel>
<title>Blog(gish) by Dan @ ritual.sh</title>
<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>
<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 }}
{{- with .OutputFormats.Get "RSS" }}
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{- end }}
{{- range $pages }}
<item>
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>
<pubDate>{{ .PublishDate.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
{{- $content := .Content }}
{{- /* Remove graph containers with all their content including canvas and script tags */ -}}
{{- $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 }}
<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 }}
<guid>{{ .Permalink }}</guid>
<description>{{ .Content | transform.XMLEscape | safeHTML }}</description>
</item>
<guid>{{ .Permalink }}</guid>
<description>{{ $content | transform.XMLEscape }}</description>
</item>
{{- end }}
</channel>
</channel>
</rss>