-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
optimise/rearrange output formats for RSS, add RSS feed per section
- Loading branch information
Showing
18 changed files
with
84 additions
and
57 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
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
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 @@ | ||
{{- .Site.Params.description -}} |
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 @@ | ||
{{- .Site.Params.description -}} |
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,3 @@ | ||
{{- range first .Site.Params.rssLimit (where (where .Site.AllPages ".IsPage" true) "Type" "post") }} | ||
{{- .Render "_rss-item" }} | ||
{{- end -}} |
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,3 @@ | ||
{{- range first .Site.Params.rssLimit (where .Site.RegularPages "Type" "post") }} | ||
{{- .Render "_rss-item" }} | ||
{{- end -}} |
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 @@ | ||
{{- .Site.Title }} | {{ T "blog" -}} |
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 @@ | ||
{{- .Site.Title }} | {{ T "postsCurLang" }} | {{ T "blog" -}} |
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
12 changes: 5 additions & 7 deletions
12
layouts/_default/index.rss-all.xml → layouts/_default/list.rss-all.xml
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 |
---|---|---|
@@ -1,20 +1,18 @@ | ||
{{ 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>{{ .Site.Title }} | {{ T "blog" }}</title> | ||
<title>{{ .Render "_feed-title" }}</title> | ||
<description>{{ .Render "_feed-description" }}</description> | ||
<link>{{ .Permalink }}</link> | ||
<description>{{ .Site.Params.description }}</description> | ||
<generator>Hugo {{ hugo.Version }}</generator> | ||
<generator>Hugo</generator> | ||
{{- with .Site.LanguageCode }}<language>{{ . }}</language>{{ end }} | ||
{{- with .Site.Params.author }} | ||
<managingEditor>[email protected] ({{ . }})</managingEditor> | ||
<webMaster>[email protected] ({{ . }})</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-ALL" }}{{ printf `<atom:link href=%q rel="self" type=%q />` .Permalink .MediaType | safeHTML }}{{ end }} | ||
{{- range first .Site.Params.rssLimit (where (where .Site.AllPages ".IsPage" true) "Type" "post") }} | ||
{{- .Render "rss-item" }} | ||
{{- end -}} | ||
{{ with .OutputFormats.Get "rss-all" }}{{ printf `<atom:link href=%q rel="self" type=%q />` .Permalink .MediaType | safeHTML }}{{ end }} | ||
{{ .Render "_feed-items" }} | ||
</channel> | ||
</rss> |
12 changes: 5 additions & 7 deletions
12
layouts/_default/index.rss.xml → layouts/_default/list.rss.xml
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 |
---|---|---|
@@ -1,20 +1,18 @@ | ||
{{ 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>{{ .Site.Title }} | {{ T "blog" }}: {{ T "postsCurLang" }}</title> | ||
<title>{{ .Render "_feed-title" }}</title> | ||
<description>{{ .Render "_feed-description" }}</description> | ||
<link>{{ .Permalink }}</link> | ||
<description>{{ .Site.Params.description }}</description> | ||
<generator>Hugo {{ hugo.Version }}</generator> | ||
<generator>Hugo</generator> | ||
{{- with .Site.LanguageCode }}<language>{{ . }}</language>{{ end }} | ||
{{- with .Site.Params.author }} | ||
<managingEditor>[email protected] ({{ . }})</managingEditor> | ||
<webMaster>[email protected] ({{ . }})</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 first .Site.Params.rssLimit (where .Site.RegularPages "Type" "post") }} | ||
{{- .Render "rss-item" }} | ||
{{- end -}} | ||
{{ with .OutputFormats.Get "rss" }}{{ printf `<atom:link href=%q rel="self" type=%q />` .Permalink .MediaType | safeHTML }}{{ end }} | ||
{{ .Render "_feed-items" }} | ||
</channel> | ||
</rss> |
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
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,27 @@ | ||
<item> | ||
<title>{{ partial "page-title" . }}</title> | ||
<link>{{ .Permalink }}?utm_source=rss&utm_medium=feed_{{ .Language }}&utm_campaign=nix</link> | ||
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> | ||
<author>[email protected] ({{ .Params.author | default .Site.Params.author }})</author> | ||
<guid isPermaLink="true">{{ .Permalink }}</guid> | ||
<description> | ||
<!-- If there's an image given --> | ||
{{- $page := . -}} | ||
{{- with .Params.image -}} | ||
{{- $url := . -}} | ||
<!-- If it isn't a URL starting with "http(s)://" or an absolute path, consider it a page resource --> | ||
{{- if findRE "^(/|http(s?)://)" $url -}} | ||
{{- $url = absURL $url -}} | ||
{{- else -}} | ||
{{- $url = ($page.Resources.GetMatch $url).Permalink -}} | ||
{{- end -}} | ||
<!-- Insert image tag --> | ||
{{- printf `<img style="width: 500px; height: auto;" src=%q alt="Post image"><br><br>` $url -}} | ||
{{- end -}} | ||
<!-- Put post summary or description: logic borrowed from layouts/post/list-item.html --> | ||
{{- $summary := .Params.description | .RenderString | default .Summary | replaceRE "(?s)<figure\\b.*?/figure>" "" | replaceRE "(?s)<div\\b.*/div>" "" }} | ||
{{- if in $summary "<p>" }}{{ $summary }}{{ else }}{{ printf "<p>%s</p>" $summary | safeHTML }}{{ end }} | ||
<!-- Read On link --> | ||
{{- printf `<p><a href=%q style="padding: 12px; background-color: #089664; color: #ffffff; text-decoration: none;">%s</a></p>` .Permalink (T "readOn") -}} | ||
</description> | ||
</item> |
This file was deleted.
Oops, something went wrong.
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 @@ | ||
{{- T "blog" }}: {{ .Title }} — {{ .Params.description -}} |
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,3 @@ | ||
{{- range first .Site.Params.rssLimit .Pages }} | ||
{{- .Render "_rss-item" }} | ||
{{- end -}} |
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 @@ | ||
{{- .Title }} | {{ T "blog" -}} |
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