diff options
author | JeffProd <jeffgazet@gmail.com> | 2018-12-31 12:54:45 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-31 12:54:45 +0300 |
commit | 08a70b1628ae344cb83fedfdc3ab9758cfb678b1 (patch) | |
tree | f3f90075bf918acff511339bf5a920c4033339fc | |
parent | 6c0303def68510ff3bb9f54e9bd5fbc3d924e381 (diff) | |
parent | 0c96e7655aafa043ce61c4756be9e2b22786b914 (diff) |
Merge pull request #8 from korney4eg/master
Add RSS support. Close #5
-rw-r--r-- | layouts/_default/rss.xml | 26 | ||||
-rw-r--r-- | layouts/partials/header.html | 4 |
2 files changed, 30 insertions, 0 deletions
diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml new file mode 100644 index 0000000..bd43b37 --- /dev/null +++ b/layouts/_default/rss.xml @@ -0,0 +1,26 @@ +<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> + <channel> + <title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title> + <link>{{ .Permalink }}</link> + <description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description> + <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 }} + <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>{{ .Summary | html }}</description> + </item> + {{ end }} + </channel> +</rss> diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 98c2915..a93904c 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -10,6 +10,10 @@ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.1/css/bulma.min.css" /> <link rel="stylesheet" href="{{ "css/blog.css" | absURL }}" /> + {{ if .RSSLink }} + <link href="{{ .RSSLink }}" rel="alternate" type="application/rss+xml" title="{{ .Site.Title }}" /> + <link href="{{ .RSSLink }}" rel="feed" type="application/rss+xml" title="{{ .Site.Title }}" /> +{{ end }} </head> <body> |