Skip to content

Commit f85ffd9

Browse files
authored
Merge pull request #51 from iza-mcac/iza-mcac-patch-1
Create rss.R.xml
2 parents 30e1e2c + 1559956 commit f85ffd9

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

blog/layouts/_default/rss.R.xml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{{- $pctx := . -}}
2+
{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
3+
{{- $pages := where $pctx.RegularPages "Params.categories" "intersect" (slice "R") -}}
4+
{{- $limit := site.Config.Services.RSS.Limit | default 10 -}}
5+
{{- if ge $limit 1 -}}{{ $pages = $pages | first $limit }}{{- end -}}
6+
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
7+
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
8+
<channel>
9+
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }} (R Posts){{ else }}{{ with .Title }}{{.}} (R Posts){{ end }}{{ end }}</title>
10+
<link>{{ .Permalink }}</link>
11+
<description>Full-content RSS feed for R posts on {{ .Site.Title }}</description>
12+
{{ with .Site.LanguageCode }}<language>{{.}}</language>{{end}}
13+
{{ with .Site.Copyright }}<copyright>{{.}}</copyright>{{end}}
14+
{{ if not .Date.IsZero }}<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
15+
<atom:link href="{{ .Permalink }}" rel="self" type="application/rss+xml" />
16+
{{ range $pages }}
17+
<item>
18+
<title>{{ .Title }}</title>
19+
<link>{{ .Permalink }}</link>
20+
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
21+
<guid>{{ .Permalink }}</guid>
22+
<description>{{ .Content | html }}</description>
23+
{{ range .Params.categories }}<category>{{ . }}</category>{{ end }}
24+
</item>
25+
{{ end }}
26+
</channel>
27+
</rss>

0 commit comments

Comments
 (0)