From 49bb433b724a846a2df3d36280c255e911e05b2c Mon Sep 17 00:00:00 2001 From: Zhou Fang Date: Wed, 9 Feb 2022 15:19:04 -0500 Subject: [PATCH 1/6] Override the default rss template to allow us to set the author of each post --- layouts/_default/rss.xml | 43 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 layouts/_default/rss.xml diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml new file mode 100644 index 0000000..16e6446 --- /dev/null +++ b/layouts/_default/rss.xml @@ -0,0 +1,43 @@ +{{- $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 "" | safeHTML }} + + + {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }} + {{ .Permalink }} + Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }} + Hugo -- gohugo.io{{ with .Site.LanguageCode }} + {{.}}{{end}}{{ with .Site.Author.email }} + {{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}}{{ with .Site.Author.email }} + {{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}}{{ with .Site.Copyright }} + {{.}}{{end}}{{ if not .Date.IsZero }} + {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}{{ end }} + {{- with .OutputFormats.Get "RSS" -}} + {{ printf "" .Permalink .MediaType | safeHTML }} + {{- end -}} + {{ range $pages }} + + {{ .Title }} + {{ .Permalink }} + {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} + {{ if .Params.author }} + {{ .Params.author }} + {{ else }} + {{ with .Site.Author.email }}{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}} + {{ end }} + {{ .Permalink }} + {{ .Summary | html }} + + {{ end }} + + \ No newline at end of file -- GitLab From 3a2bde9b3cb77b63c19a2d0386c9fd287ce2a906 Mon Sep 17 00:00:00 2001 From: Zhou Fang Date: Tue, 15 Feb 2022 11:09:51 -0500 Subject: [PATCH 2/6] updated author for testing --- exampleSite/content/components/adopters/ecdtools.md | 1 + exampleSite/content/translations.md | 1 + 2 files changed, 2 insertions(+) diff --git a/exampleSite/content/components/adopters/ecdtools.md b/exampleSite/content/components/adopters/ecdtools.md index 1541c3c..5e876fc 100644 --- a/exampleSite/content/components/adopters/ecdtools.md +++ b/exampleSite/content/components/adopters/ecdtools.md @@ -2,6 +2,7 @@ title: "ECD Tools Project Adopters" date: 2019-09-10T15:50:25-04:00 hide_sidebar: true +author: "Demo Demo" --- {{< eclipsefdn_adopters working_group="cloud-development-tools" >}} \ No newline at end of file diff --git a/exampleSite/content/translations.md b/exampleSite/content/translations.md index 1191c3b..3a65246 100644 --- a/exampleSite/content/translations.md +++ b/exampleSite/content/translations.md @@ -2,6 +2,7 @@ title: "Translations of the Hugo Solstice theme" description: "A guide to translating the Hugo Solstice theme into new languages." date: 2020-01-19T00:00:00-04:00 +author: "test test" --- So you want to translate your site, eh? Here are a few things you'll need! The first thing isn't a file, but a code, a language code. This should be the ISO 639-1 code that represents the language you wish to translate for the site. An easily read list of these codes can be found on the [Wikipedia page for ISO 639-1 codes](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes). This code will be used a few times, so please note it down. -- GitLab From 7d3a447f77e80d7636828944fc04ae5feeb006d1 Mon Sep 17 00:00:00 2001 From: Zhou Fang Date: Tue, 15 Feb 2022 11:20:19 -0500 Subject: [PATCH 3/6] still testing author --- exampleSite/content/components/adopters/ecdtools.md | 2 +- exampleSite/content/translations.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/exampleSite/content/components/adopters/ecdtools.md b/exampleSite/content/components/adopters/ecdtools.md index 5e876fc..e97d8e3 100644 --- a/exampleSite/content/components/adopters/ecdtools.md +++ b/exampleSite/content/components/adopters/ecdtools.md @@ -2,7 +2,7 @@ title: "ECD Tools Project Adopters" date: 2019-09-10T15:50:25-04:00 hide_sidebar: true -author: "Demo Demo" +author: "demo@test.com" --- {{< eclipsefdn_adopters working_group="cloud-development-tools" >}} \ No newline at end of file diff --git a/exampleSite/content/translations.md b/exampleSite/content/translations.md index 3a65246..6ecc0ab 100644 --- a/exampleSite/content/translations.md +++ b/exampleSite/content/translations.md @@ -2,7 +2,7 @@ title: "Translations of the Hugo Solstice theme" description: "A guide to translating the Hugo Solstice theme into new languages." date: 2020-01-19T00:00:00-04:00 -author: "test test" +author: "demo@test.com" --- So you want to translate your site, eh? Here are a few things you'll need! The first thing isn't a file, but a code, a language code. This should be the ISO 639-1 code that represents the language you wish to translate for the site. An easily read list of these codes can be found on the [Wikipedia page for ISO 639-1 codes](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes). This code will be used a few times, so please note it down. -- GitLab From cf74f4d0531966a2614d514eddc44a91942d786a Mon Sep 17 00:00:00 2001 From: Zhou Fang Date: Tue, 15 Feb 2022 14:15:31 -0500 Subject: [PATCH 4/6] still testing author --- exampleSite/content/components/adopters/ecdtools.md | 2 +- exampleSite/content/translations.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/exampleSite/content/components/adopters/ecdtools.md b/exampleSite/content/components/adopters/ecdtools.md index e97d8e3..ea195ff 100644 --- a/exampleSite/content/components/adopters/ecdtools.md +++ b/exampleSite/content/components/adopters/ecdtools.md @@ -2,7 +2,7 @@ title: "ECD Tools Project Adopters" date: 2019-09-10T15:50:25-04:00 hide_sidebar: true -author: "demo@test.com" +author: "demo@test.com (Peter Test)" --- {{< eclipsefdn_adopters working_group="cloud-development-tools" >}} \ No newline at end of file diff --git a/exampleSite/content/translations.md b/exampleSite/content/translations.md index 6ecc0ab..4bf1e74 100644 --- a/exampleSite/content/translations.md +++ b/exampleSite/content/translations.md @@ -2,7 +2,7 @@ title: "Translations of the Hugo Solstice theme" description: "A guide to translating the Hugo Solstice theme into new languages." date: 2020-01-19T00:00:00-04:00 -author: "demo@test.com" +author: "demo@test.com (Peter Test)" --- So you want to translate your site, eh? Here are a few things you'll need! The first thing isn't a file, but a code, a language code. This should be the ISO 639-1 code that represents the language you wish to translate for the site. An easily read list of these codes can be found on the [Wikipedia page for ISO 639-1 codes](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes). This code will be used a few times, so please note it down. -- GitLab From 61d6777c60d37054403acef460ad8b0440465d9c Mon Sep 17 00:00:00 2001 From: Zhou Fang Date: Thu, 17 Feb 2022 16:01:31 -0500 Subject: [PATCH 5/6] Added default value for author and email --- exampleSite/content/components/adopters/ecdtools.md | 2 +- exampleSite/content/components/adopters/iot.md | 2 ++ exampleSite/content/translations.md | 2 +- layouts/_default/rss.xml | 4 ++-- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/exampleSite/content/components/adopters/ecdtools.md b/exampleSite/content/components/adopters/ecdtools.md index ea195ff..98e5889 100644 --- a/exampleSite/content/components/adopters/ecdtools.md +++ b/exampleSite/content/components/adopters/ecdtools.md @@ -2,7 +2,7 @@ title: "ECD Tools Project Adopters" date: 2019-09-10T15:50:25-04:00 hide_sidebar: true -author: "demo@test.com (Peter Test)" +author: "Peter Test" --- {{< eclipsefdn_adopters working_group="cloud-development-tools" >}} \ No newline at end of file diff --git a/exampleSite/content/components/adopters/iot.md b/exampleSite/content/components/adopters/iot.md index 87d811d..0b26c0c 100644 --- a/exampleSite/content/components/adopters/iot.md +++ b/exampleSite/content/components/adopters/iot.md @@ -2,6 +2,8 @@ title: "IoT Project Adopters" date: 2019-09-10T15:50:25-04:00 hide_sidebar: true +author: "Peter Test" +email: "peter@demo.com" --- {{< eclipsefdn_adopters working_group="internet-things-iot" >}} \ No newline at end of file diff --git a/exampleSite/content/translations.md b/exampleSite/content/translations.md index 4bf1e74..edb9a68 100644 --- a/exampleSite/content/translations.md +++ b/exampleSite/content/translations.md @@ -2,7 +2,7 @@ title: "Translations of the Hugo Solstice theme" description: "A guide to translating the Hugo Solstice theme into new languages." date: 2020-01-19T00:00:00-04:00 -author: "demo@test.com (Peter Test)" +email: "test@demo.com" --- So you want to translate your site, eh? Here are a few things you'll need! The first thing isn't a file, but a code, a language code. This should be the ISO 639-1 code that represents the language you wish to translate for the site. An easily read list of these codes can be found on the [Wikipedia page for ISO 639-1 codes](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes). This code will be used a few times, so please note it down. diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml index 16e6446..c0821be 100644 --- a/layouts/_default/rss.xml +++ b/layouts/_default/rss.xml @@ -30,8 +30,8 @@ {{ .Title }} {{ .Permalink }} {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} - {{ if .Params.author }} - {{ .Params.author }} + {{ if or (.Params.author) (.Params.email) }} + {{ .Params.email | default .Site.Author.email }} ({{ .Params.author | default .Site.Author.name }}) {{ else }} {{ with .Site.Author.email }}{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}} {{ end }} -- GitLab From 3f4550dfe479d2835b11a116a93fb429377374e3 Mon Sep 17 00:00:00 2001 From: Zhou Fang Date: Thu, 17 Feb 2022 16:09:06 -0500 Subject: [PATCH 6/6] Added default value for the site author and email when they are empty --- layouts/_default/rss.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml index c0821be..7d95304 100644 --- a/layouts/_default/rss.xml +++ b/layouts/_default/rss.xml @@ -31,7 +31,7 @@ {{ .Permalink }} {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} {{ if or (.Params.author) (.Params.email) }} - {{ .Params.email | default .Site.Author.email }} ({{ .Params.author | default .Site.Author.name }}) + {{ .Params.email | default .Site.Author.email | default "no+reply@eclipse-foundation.org" }} ({{ .Params.author | default .Site.Author.name | default "Eclipse Foundation" }}) {{ else }} {{ with .Site.Author.email }}{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}} {{ end }} -- GitLab