Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/rmaguiar/hugo-theme-color-your-world.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaphael Aguiar <rmaguiar@tuta.io>2020-08-20 17:54:46 +0300
committerRaphael Aguiar <rmaguiar@tuta.io>2020-08-20 17:54:46 +0300
commit91bb69cd7c7f7570359b544ae8427c12895ca262 (patch)
treefd0f0e60c5c2a055bb99577185d3edeb4b9e6b92
parent89be9f2f21c64c12d677128381c2b6dd3d6b1bbf (diff)
Update RSS template and minor changes
-rw-r--r--layouts/_default/index.xml46
-rw-r--r--layouts/_default/rss.xml40
-rw-r--r--layouts/_default/single.html10
-rw-r--r--layouts/index.html6
-rw-r--r--layouts/partials/content-svg.html10
-rw-r--r--layouts/partials/head.html7
6 files changed, 63 insertions, 56 deletions
diff --git a/layouts/_default/index.xml b/layouts/_default/index.xml
deleted file mode 100644
index 2958297..0000000
--- a/layouts/_default/index.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-{{ 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 }}</title>
- <link>{{ .Permalink }}</link>
- <description>{{ .Site.Params.description }}</description>
- <generator>Hugo -- gohugo.io</generator>
-
- {{ with .Site.Language }}
- <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>{{ . | markdownify | plainify }}</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 .Site.RegularPages }}
- {{ if not .Params.sitemapExclude }}
- <item>
- <title>{{ .Title | emojify }}</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>{{ if .Description }}{{ .Description | emojify }}{{ else }}{{ .Summary | plainify | truncate 140 }}{{ end }}</description>
- </item>
- {{ end }}
- {{ end }}
- </channel>
-</rss> \ No newline at end of file
diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml
new file mode 100644
index 0000000..eb0f835
--- /dev/null
+++ b/layouts/_default/rss.xml
@@ -0,0 +1,40 @@
+{{- $pctx := . -}}
+{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
+{{- $pages := slice -}}
+{{- if or $.IsHome $.IsSection -}}
+{{- $pages = $pctx.RegularPages -}}
+{{- else -}}
+{{- $pages = $pctx.Pages -}}
+{{- end -}}
+{{- $pages = where $pages "Params.sitemapexclude" "ne" 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">
+ <channel>
+ <title>{{ .Site.Title }}</title>
+ <link>{{ .Permalink }}</link>
+ <description>{{ .Site.Params.description }}</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>{{ . | markdownify | plainify }}</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 | emojify }}</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>{{ if .Description }}{{ .Description | emojify }}{{ else }}{{ .Summary | html }}{{ end }}</description>
+ </item>
+ {{ end }}
+ </channel>
+</rss> \ No newline at end of file
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 2b0a617..48c7aee 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -54,13 +54,5 @@
{{ end }}
{{ define "svg-extra" }}
- <symbol viewBox="0 0 448 512" id="hashtag">
- <path d="M440.667 182.109l7.143-40c1.313-7.355-4.342-14.109-11.813-14.109h-74.81l14.623-81.891C377.123 38.754 371.468 32 363.997 32h-40.632a12 12 0 0 0-11.813 9.891L296.175 128H197.54l14.623-81.891C213.477 38.754 207.822 32 200.35 32h-40.632a12 12 0 0 0-11.813 9.891L132.528 128H53.432a12 12 0 0 0-11.813 9.891l-7.143 40C33.163 185.246 38.818 192 46.289 192h74.81L98.242 320H19.146a12 12 0 0 0-11.813 9.891l-7.143 40C-1.123 377.246 4.532 384 12.003 384h74.81L72.19 465.891C70.877 473.246 76.532 480 84.003 480h40.632a12 12 0 0 0 11.813-9.891L151.826 384h98.634l-14.623 81.891C234.523 473.246 240.178 480 247.65 480h40.632a12 12 0 0 0 11.813-9.891L315.472 384h79.096a12 12 0 0 0 11.813-9.891l7.143-40c1.313-7.355-4.342-14.109-11.813-14.109h-74.81l22.857-128h79.096a12 12 0 0 0 11.813-9.891zM261.889 320h-98.634l22.857-128h98.634l-22.857 128z"/>
- </symbol>
-
- {{ if .Site.Params.Style.hasIconAsFootnoteReturnLink }}
- <symbol viewBox="0 0 320 512" id="caret-down">
- <path d="M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z"/>
- </symbol>
- {{ end }}
+ {{ partial "content-svg" . }}
{{ end }}
diff --git a/layouts/index.html b/layouts/index.html
index c4c3a6c..dc92444 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -22,3 +22,9 @@
</main>
{{ end }}
+
+{{ define "svg-extra" }}
+ {{ if .Content }}
+ {{ partial "content-svg" . }}
+ {{ end }}
+{{ end }}
diff --git a/layouts/partials/content-svg.html b/layouts/partials/content-svg.html
new file mode 100644
index 0000000..73b0d3c
--- /dev/null
+++ b/layouts/partials/content-svg.html
@@ -0,0 +1,10 @@
+<!-- SVG symbols related to pages with content -->
+<symbol viewBox="0 0 448 512" id="hashtag">
+ <path d="M440.667 182.109l7.143-40c1.313-7.355-4.342-14.109-11.813-14.109h-74.81l14.623-81.891C377.123 38.754 371.468 32 363.997 32h-40.632a12 12 0 0 0-11.813 9.891L296.175 128H197.54l14.623-81.891C213.477 38.754 207.822 32 200.35 32h-40.632a12 12 0 0 0-11.813 9.891L132.528 128H53.432a12 12 0 0 0-11.813 9.891l-7.143 40C33.163 185.246 38.818 192 46.289 192h74.81L98.242 320H19.146a12 12 0 0 0-11.813 9.891l-7.143 40C-1.123 377.246 4.532 384 12.003 384h74.81L72.19 465.891C70.877 473.246 76.532 480 84.003 480h40.632a12 12 0 0 0 11.813-9.891L151.826 384h98.634l-14.623 81.891C234.523 473.246 240.178 480 247.65 480h40.632a12 12 0 0 0 11.813-9.891L315.472 384h79.096a12 12 0 0 0 11.813-9.891l7.143-40c1.313-7.355-4.342-14.109-11.813-14.109h-74.81l22.857-128h79.096a12 12 0 0 0 11.813-9.891zM261.889 320h-98.634l22.857-128h98.634l-22.857 128z"/>
+</symbol>
+
+{{ if .Site.Params.Style.hasIconAsFootnoteReturnLink }}
+ <symbol viewBox="0 0 320 512" id="caret-down">
+ <path d="M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z"/>
+ </symbol>
+{{ end }} \ No newline at end of file
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index acd3467..7509980 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -1,5 +1,6 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
+<meta name="generator" content="Hugo {{ hugo.Version }} -- gohugo.io / Color Your World -- gitlab.com/rmaguiar/hugo-theme-color-your-world">
<!-- I'm 99% sure there's a smarter way of doing it but whatever -->
{{ $currentTitle := (.Title | emojify) }}
@@ -225,8 +226,12 @@
<meta name="twitter:dnt" content="on">
{{ end }}
+
<!-- Feed -->
-<link rel="alternate" type="application/rss+xml" href="{{ "index.xml" | relURL }}" title="{{ .Site.Title }}">
+{{ with .OutputFormats.Get "RSS" }}
+ <link rel="alternate" type="application/rss+xml" href="{{ .Permalink }}" title="{{ $.Site.Title }}">
+{{ end }}
+
<!-- i18n -->
{{ if .IsTranslated }}