massively improve rss feeds
This commit is contained in:
parent
8b738af38e
commit
1d3112ec01
5 changed files with 116 additions and 45 deletions
BIN
assets/rss-image.png
Normal file
BIN
assets/rss-image.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
|
@ -5,6 +5,7 @@ disableHugoGeneratorInject: true
|
|||
enableGitInfo: true
|
||||
enableRobotsTXT: true
|
||||
languageCode: 'en-us'
|
||||
summarylength: 15
|
||||
|
||||
minify:
|
||||
tdewolff:
|
||||
|
@ -24,6 +25,7 @@ params:
|
|||
|
||||
author:
|
||||
name: 'redstrate'
|
||||
email: 'josh@redstrate.com'
|
||||
|
||||
permalinks:
|
||||
blog: 'blog/:year/:month/:title/'
|
||||
|
|
|
@ -16,25 +16,49 @@
|
|||
xmlns:atom="http://www.w3.org/2005/Atom"
|
||||
xml:base="{{ .Site.BaseURL }}">
|
||||
<channel>
|
||||
<title>{{ .Site.Author.name }}'s blog</title>
|
||||
<title>{{ .Site.Author.name }}'s Blog</title>
|
||||
<link>{{ .Permalink }}</link>
|
||||
<description>My blog where I post about the things I like.</description>
|
||||
{{ with .Site.LanguageCode }}<language>{{.}}</language>{{end}}{{ with .Site.Author.email }}
|
||||
<managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }}
|
||||
<webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
|
||||
<copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
|
||||
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
|
||||
<description>My blog where I post about the things I like and work on!</description>
|
||||
|
||||
{{ with .Site.LanguageCode }}<language>{{.}}</language>{{end}}
|
||||
|
||||
{{ with .Site.Copyright }}
|
||||
<copyright>{{.}}</copyright>
|
||||
{{end}}
|
||||
|
||||
{{ if not .Date.IsZero }}
|
||||
<lastBuildDate>{{ .Date.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 -}}
|
||||
|
||||
<docs>https://www.rssboard.org/rss-specification</docs>
|
||||
|
||||
{{ with resources.Get "rss-image.png" }}
|
||||
<image>
|
||||
<url>{{ .Permalink }}</url>
|
||||
<title>{{ $.Site.Author.name }}'s Art</title>
|
||||
<link>{{ $.Permalink }}</link>
|
||||
<width>100</width>
|
||||
<height>100</height>
|
||||
</image>
|
||||
{{ end }}
|
||||
|
||||
{{ range $pages }}
|
||||
{{ if not (.Param "excludefeed") }}
|
||||
<item>
|
||||
<title>{{ .Title }}</title>
|
||||
|
||||
<link>{{ .Permalink }}</link>
|
||||
{{ with $.Site.Author.name }}<author>{{ . }}</author>{{ end }}
|
||||
|
||||
{{ with $.Site.Author.name }}
|
||||
<author>{{ . }}</author>
|
||||
{{ end }}
|
||||
|
||||
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
|
||||
{{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}}
|
||||
|
||||
<guid>{{ .Permalink }}</guid>
|
||||
<description>{{ "<![CDATA[" | safeHTML }} {{ .Summary }}]]></description>
|
||||
<content:encoded>{{ "<![CDATA[" | safeHTML }} {{ partial "rss.html" . | safeHTML }}]]></content:encoded>
|
||||
|
|
|
@ -16,28 +16,74 @@
|
|||
xmlns:atom="http://www.w3.org/2005/Atom"
|
||||
xml:base="{{ .Site.BaseURL }}">
|
||||
<channel>
|
||||
<title>{{ .Site.Author.name }}'s art</title>
|
||||
<title>{{ .Site.Author.name }}'s Art</title>
|
||||
<link>{{ .Permalink }}</link>
|
||||
<description>Feed of the art that I make!</description>
|
||||
{{ with .Site.LanguageCode }}<language>{{.}}</language>{{end}}{{ with .Site.Author.email }}
|
||||
<managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }}
|
||||
<webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
|
||||
<copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
|
||||
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
|
||||
{{ with .Site.LanguageCode }}
|
||||
<language>{{.}}</language>
|
||||
{{end}}
|
||||
|
||||
{{ with .Site.Copyright }}
|
||||
<copyright>{{.}}</copyright>
|
||||
{{end}}
|
||||
|
||||
{{ if not .Date.IsZero }}
|
||||
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>
|
||||
{{ end }}
|
||||
|
||||
<docs>https://www.rssboard.org/rss-specification</docs>
|
||||
|
||||
{{ with resources.Get "rss-image.png" }}
|
||||
<image>
|
||||
<url>{{ .Permalink }}</url>
|
||||
<title>{{ $.Site.Author.name }}'s Art</title>
|
||||
<link>{{ $.Permalink }}</link>
|
||||
<width>100</width>
|
||||
<height>100</height>
|
||||
</image>
|
||||
{{ end }}
|
||||
|
||||
{{- with .OutputFormats.Get "RSS" -}}
|
||||
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
|
||||
{{- end -}}
|
||||
|
||||
{{ range $pages }}
|
||||
{{ if not (.Param "excludefeed") }}
|
||||
<item>
|
||||
<title>{{ .Title }}</title>
|
||||
<link>{{ .Permalink }}</link>'
|
||||
{{ with $.Site.Author.name }}<author>{{ . }}</author>{{ end }}
|
||||
{{ with .Title }}
|
||||
<title>{{ . }}</title>
|
||||
{{ else }}
|
||||
<title>Untitled Artwork</title>
|
||||
{{ end }}
|
||||
|
||||
<link>{{ .Permalink }}</link>
|
||||
|
||||
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
|
||||
{{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}}
|
||||
|
||||
<guid>{{ .Permalink }}</guid>
|
||||
<description>{{ "<![CDATA[" | safeHTML }} {{ .Summary }}]]></description>
|
||||
<content:encoded>{{ "<![CDATA[" | safeHTML }} {{ partial "rss.html" . | safeHTML }}]]></content:encoded>
|
||||
|
||||
{{ with .Summary }}
|
||||
<description>{{ "<![CDATA[" | safeHTML }} {{ . | safeHTML }}]]></description>
|
||||
{{ else }}
|
||||
<description>This artwork has no description.</description>
|
||||
{{ end }}
|
||||
|
||||
{{ with $.Site.Author.name }}
|
||||
<author>{{ . }}</author>
|
||||
{{ end }}
|
||||
|
||||
<content:encoded>{{ "<![CDATA[" | safeHTML }}
|
||||
{{ $pageScope := . }}
|
||||
{{ with resources.Get .Params.filename }}
|
||||
<img alt="{{ $pageScope.Params.alt_text }}" src="{{ .Permalink }}"/>
|
||||
{{ end }}
|
||||
|
||||
{{ with .Content }}
|
||||
<p>{{ . | safeHTML }}</p>
|
||||
{{ else }}
|
||||
<p>This artwork has no additional commentary.</p>
|
||||
{{ end }}]]>
|
||||
</content:encoded>
|
||||
</item>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
{{ $html := .Content | safeHTML }}
|
||||
|
||||
{{ $hrefs := findRE "href=\"([^\"]*)\"" $html }}
|
||||
|
|
Loading…
Add table
Reference in a new issue