From 8d5b0dc1e7553fa09741485b22d0299967cd575e Mon Sep 17 00:00:00 2001 From: Victor Pogor Date: Mon, 15 Feb 2021 19:23:37 +0000 Subject: [PATCH] fix(rss): fixed wrong author value re #116 --- exampleSite/config.toml | 2 +- layouts/index.rss.xml | 2 +- layouts/partials/rss/item.html | 15 +++++++++++---- layouts/posts/rss.xml | 2 +- layouts/taxonomy/rss.xml | 2 +- 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/exampleSite/config.toml b/exampleSite/config.toml index b7c51451..77908662 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -1,4 +1,4 @@ -baseURL = "https://example.com" +baseURL = "https://codeit.suntprogramator.dev" # [en, zh-cn, fr, pl, ...] determines default content language defaultContentLanguage = "en" # theme diff --git a/layouts/index.rss.xml b/layouts/index.rss.xml index 355c26a5..137d7e21 100644 --- a/layouts/index.rss.xml +++ b/layouts/index.rss.xml @@ -1,4 +1,4 @@ - + {{- .Site.Title -}} diff --git a/layouts/partials/rss/item.html b/layouts/partials/rss/item.html index 28256b49..64da9536 100644 --- a/layouts/partials/rss/item.html +++ b/layouts/partials/rss/item.html @@ -1,4 +1,4 @@ -{{- $params := .Page.Params | merge .Site.Params.Page | merge (dict "author" .Site.Author.name) -}} +{{- $params := .Page.Params | merge .Site.Params.Page | merge (dict "author" .Site.Author.name "email" .Site.Author.email) -}} <item> <title> {{- .Page.Title -}} @@ -9,9 +9,16 @@ <pubDate> {{- .Page.Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}} </pubDate> - <author> - {{- .params.author | default (T "author") -}} - </author> + {{- with $params.email -}} + <author> + {{- $params.email -}} + </author> + {{- end -}} + {{- with $params.author -}} + <dc:creator> + {{- $params.author -}} + </dc:creator> + {{- end -}} <guid> {{- .Page.Permalink -}} </guid> diff --git a/layouts/posts/rss.xml b/layouts/posts/rss.xml index 454cdec4..3231bd42 100644 --- a/layouts/posts/rss.xml +++ b/layouts/posts/rss.xml @@ -1,4 +1,4 @@ -<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"> +<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"> <channel> <title> {{- .Params.Title | default (T .Section) | default .Section | dict "Some" | T "allSome" }} - {{ .Site.Title -}} diff --git a/layouts/taxonomy/rss.xml b/layouts/taxonomy/rss.xml index a597e569..45263a5a 100644 --- a/layouts/taxonomy/rss.xml +++ b/layouts/taxonomy/rss.xml @@ -1,4 +1,4 @@ -<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"> +<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"> <channel> <title> {{- .Title }} - {{ T .Data.Singular | default .Data.Singular }} - {{ .Site.Title -}}