-
Notifications
You must be signed in to change notification settings - Fork 363
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{{- $pages := .Pages -}} | ||
{{- if $.IsHome -}} | ||
{{/* get all regular pages instead of pages in a section */}} | ||
{{- $pages = where site.RegularPages "Section" "in" site.Params.mainSections -}} | ||
{{- end }} | ||
{{- $pages = where $pages "Params.hidden" "!=" true -}} | ||
|
||
{{- $limit := site.Config.Services.RSS.Limit -}} | ||
{{- if ge $limit 1 -}} | ||
{{- $pages = $pages | first $limit -}} | ||
{{- end -}} | ||
|
||
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }} | ||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"> | ||
<channel> | ||
<title>{{ site.Title }}</title> | ||
<link>{{ .Permalink }}</link> | ||
<description>Recent updates on {{ site.Title }}</description> | ||
{{- with site.Params.logo }} | ||
<image> | ||
<url>{{ .icon | absURL }}</url> | ||
<link>{{ .icon | absURL }}</link> | ||
</image> | ||
{{- end }} | ||
<generator>Hugo -- gohugo.io</generator>{{ 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 .OutputFormats.Get "RSS" -}} | ||
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }} | ||
{{- end -}} | ||
{{ range $pages }} | ||
{{- if and (ne .Layout `search`) (ne .Layout `archives`) }} | ||
<item> | ||
<title>{{ .Title }}</title> | ||
<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>{{ with .Description | html }}{{ . }}{{ else }}{{ .Summary | html }}{{ end -}}</description> | ||
{{- if not site.Params.RSSNoContent}} | ||
<content:encoded>{{ (printf "<![CDATA[%s]]>" .Content) | safeHTML }}</content:encoded> | ||
{{- end }} | ||
</item> | ||
{{- end }} | ||
{{ end }} | ||
</channel> | ||
</rss> |