Remove trailing whitespace and tabs from RSS templates

The rss templates had some tab characters mixed in with the spaces.
Additionally there would end up being trailing whitespace in output
rss feeds, which looks red in git diff.
This commit is contained in:
Kyle Anderson 2020-08-11 22:34:04 -07:00 committed by Bjørn Erik Pedersen
parent f3cb0be35a
commit 5f42590144
4 changed files with 28 additions and 26 deletions

View file

@ -43,9 +43,9 @@ var EmbeddedTemplates = [][2]string{
<webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }} <webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
<copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }} <copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }} <lastBuildDate>{{ .Date.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> <item>
<title>{{ .Title }}</title> <title>{{ .Title }}</title>
@ -57,7 +57,8 @@ var EmbeddedTemplates = [][2]string{
</item> </item>
{{ end }} {{ end }}
</channel> </channel>
</rss>`}, </rss>
`},
{`_default/sitemap.xml`, `{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }} {`_default/sitemap.xml`, `{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml"> xmlns:xhtml="http://www.w3.org/1999/xhtml">
@ -79,17 +80,18 @@ var EmbeddedTemplates = [][2]string{
/>{{ end }} />{{ end }}
</url> </url>
{{ end }} {{ end }}
</urlset>`}, </urlset>
`},
{`_default/sitemapindex.xml`, `{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }} {`_default/sitemapindex.xml`, `{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{{ range . }} {{ range . }}
<sitemap> <sitemap>
<loc>{{ .SitemapAbsURL }}</loc> <loc>{{ .SitemapAbsURL }}</loc>
{{ if not .LastChange.IsZero }} {{ if not .LastChange.IsZero }}
<lastmod>{{ .LastChange.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</lastmod> <lastmod>{{ .LastChange.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</lastmod>
{{ end }} {{ end }}
</sitemap> </sitemap>
{{ end }} {{ end }}
</sitemapindex> </sitemapindex>
`}, `},
{`alias.html`, `<!DOCTYPE html><html><head><title>{{ .Permalink }}</title><link rel="canonical" href="{{ .Permalink }}"/><meta name="robots" content="noindex"><meta charset="utf-8" /><meta http-equiv="refresh" content="0; url={{ .Permalink }}" /></head></html>`}, {`alias.html`, `<!DOCTYPE html><html><head><title>{{ .Permalink }}</title><link rel="canonical" href="{{ .Permalink }}"/><meta name="robots" content="noindex"><meta charset="utf-8" /><meta http-equiv="refresh" content="0; url={{ .Permalink }}" /></head></html>`},

View file

@ -22,9 +22,9 @@
<webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }} <webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
<copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }} <copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }} <lastBuildDate>{{ .Date.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> <item>
<title>{{ .Title }}</title> <title>{{ .Title }}</title>
@ -36,4 +36,4 @@
</item> </item>
{{ end }} {{ end }}
</channel> </channel>
</rss> </rss>

View file

@ -19,4 +19,4 @@
/>{{ end }} />{{ end }}
</url> </url>
{{ end }} {{ end }}
</urlset> </urlset>

View file

@ -1,11 +1,11 @@
{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }} {{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{{ range . }} {{ range . }}
<sitemap> <sitemap>
<loc>{{ .SitemapAbsURL }}</loc> <loc>{{ .SitemapAbsURL }}</loc>
{{ if not .LastChange.IsZero }} {{ if not .LastChange.IsZero }}
<lastmod>{{ .LastChange.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</lastmod> <lastmod>{{ .LastChange.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</lastmod>
{{ end }} {{ end }}
</sitemap> </sitemap>
{{ end }} {{ end }}
</sitemapindex> </sitemapindex>