RSS: Improves the RSS template
Reuses the latest Hugo embedded RSS template and adapts it with full content and publish date. Fixes #9, thus restoring a RSS feed different for the entire site, the section, taxonomy terms, and so on. Co-Authored-by: Igor Milhit <igor@milhit.ch>pull/32/head 0.1.1
parent
31b27df95f
commit
ab91d9b590
|
@ -7,15 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
||||
|
||||
## [Unreleased](https://framagit.org/iGormilhit/portfoliGor/compare/0.1.0...HEAD)
|
||||
## [Unreleased](https://framagit.org/iGormilhit/portfoliGor/compare/0.1.1...HEAD)
|
||||
|
||||
## [0.1.1](https://framagit.org/iGormilhit/portfoliGor/compare/0.1.0...0.1.1) - 2020-06-01
|
||||
|
||||
### Fixed
|
||||
|
||||
- RSS: Improves the RSS template [`#9`](https://framagit.org/iGormilhit/portfoliGor/issues/9)
|
||||
- layout: improve list of post taxonomy terms [`#10`](https://framagit.org/iGormilhit/portfoliGor/issues/10)
|
||||
|
||||
### Commits
|
||||
|
||||
- documentation: add a changelog and auto-changelog [`891ee57`](https://framagit.org/iGormilhit/portfoliGor/commit/891ee575858f4c02795171ffeaeb7640de9ead92)
|
||||
- documentation: add a changelog and auto-changelog [`31b27df`](https://framagit.org/iGormilhit/portfoliGor/commit/31b27df95ffcab2b5857fa63346e6a8a6998b5d1)
|
||||
- lists: sort list by reverse publication date [`920fe4d`](https://framagit.org/iGormilhit/portfoliGor/commit/920fe4d1566b9755b2551854a6042beec8f8905a)
|
||||
|
||||
## 0.1.0 - 2020-05-22
|
||||
|
|
|
@ -1,4 +1,16 @@
|
|||
{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>" | safeHTML }}
|
||||
{{- $pctx := . -}}
|
||||
{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
|
||||
{{- $pages := slice -}}
|
||||
{{- if or $.IsHome $.IsSection -}}
|
||||
{{- $pages = $pctx.RegularPages -}}
|
||||
{{- else -}}
|
||||
{{- $pages = $pctx.Pages -}}
|
||||
{{- end -}}
|
||||
{{- $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">
|
||||
<channel>
|
||||
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
|
||||
|
@ -13,11 +25,11 @@
|
|||
{{ with .OutputFormats.Get "RSS" }}
|
||||
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
|
||||
{{ end }}
|
||||
{{ range .Site.RegularPages }}
|
||||
{{ range $pages }}
|
||||
<item>
|
||||
<title>{{ .Title }}</title>
|
||||
<link>{{ .Permalink }}</link>
|
||||
<pubDate>{{ .PublishDate.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
|
||||
<pubDate>{{ .PublishDate.Format "2006-01-02" | safeHTML }}</pubDate>
|
||||
{{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}}
|
||||
<guid>{{ .Permalink }}</guid>
|
||||
<description>{{ .Content | html }}</description>
|
||||
|
|
|
@ -13,8 +13,7 @@
|
|||
{{ $styles := resources.Get "scss/main.scss" | toCSS $options | minify }}
|
||||
<link rel="stylesheet" href="{{ $styles.Permalink }}" media="screen">
|
||||
{{ end }}
|
||||
<!-- <link rel="stylesheet" type="text/css" href="{{ .Site.BaseURL }}style.css"> -->
|
||||
{{ with .OutputFormats.Get "RSS" }}
|
||||
{{ range .AlternativeOutputFormats -}}
|
||||
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
|
||||
{{ end }}
|
||||
{{ end -}}
|
||||
</head>
|
||||
|
|
Loading…
Reference in New Issue