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 }}
@ -42,13 +40,16 @@
{{ 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 }}
{{- $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> <item>
<title>{{ .Title }}</title> <title>{{ .Title }}</title>
<link>{{ .Permalink }}</link> <link>{{ .Permalink }}</link>
<pubDate>{{ .PublishDate.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> <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>