From b3cbad9d7e1d6e126efcc82642839a22bd9707db Mon Sep 17 00:00:00 2001 From: Toshaan Bharvani Date: Mon, 3 Jan 2022 21:54:16 +0100 Subject: [PATCH] add other outputs to members * json output * rss xml output Signed-off-by: Toshaan Bharvani --- content/members/_index.md | 6 ++- .../layouts/members/list.json | 25 +++++++++++ .../layouts/members/list.xml | 41 +++++++++++++++++++ 3 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 themes/openpowerfoundation/layouts/members/list.json create mode 100644 themes/openpowerfoundation/layouts/members/list.xml diff --git a/content/members/_index.md b/content/members/_index.md index b844e61..ea80610 100644 --- a/content/members/_index.md +++ b/content/members/_index.md @@ -1,5 +1,9 @@ --- title: 'Members' -date: 2021-03-03 +outputs: + - html + - json + - rss +date: 2022-01-03 draft: false --- diff --git a/themes/openpowerfoundation/layouts/members/list.json b/themes/openpowerfoundation/layouts/members/list.json new file mode 100644 index 0000000..114c201 --- /dev/null +++ b/themes/openpowerfoundation/layouts/members/list.json @@ -0,0 +1,25 @@ +{{- $.Scratch.Add "index" slice -}} +{{- $.Scratch.Add "groups" slice -}} +{{- range .Data.Pages -}} + {{- $membercode := .File.BaseFileName -}} + {{- range where .Site.RegularPages "Section" "groups" -}} + {{- $wgname := .Title | plainify -}} + {{- if .Param "members" -}} + {{- range $member := .Param "members" -}} + {{- if eq $member $membercode -}} + {{- $.Scratch.Add "groups" $wgname -}} + {{- end -}} + {{- end -}} + {{- end -}} + {{- end -}} + {{- $.Scratch.Add "index" (dict + "title" .Title + "permalink" .Permalink + "contents" .Plain + "level" .Params.level + "joined" .Params.joined + "country" .Params.country + "groups" ($.Scratch.Get "groups") + ) }} +{{- end -}} +{{- $.Scratch.Get "index" | jsonify -}} diff --git a/themes/openpowerfoundation/layouts/members/list.xml b/themes/openpowerfoundation/layouts/members/list.xml new file mode 100644 index 0000000..754fe5a --- /dev/null +++ b/themes/openpowerfoundation/layouts/members/list.xml @@ -0,0 +1,41 @@ +{{- 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 .Data.Pages.ByDate.Reverse }} + + {{ .Title }} + {{ .Permalink }} + {{- .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML -}} + {{ .Permalink }} + {{ .Params.joined }} + {{ .Params.country }} + + {{- $membercode := .File.BaseFileName -}} + {{ range where .Site.RegularPages "Section" "groups" }} + {{- $wgname := .Title | html -}} + {{- if .Param "members" -}} + {{- range $member := .Param "members" -}} + {{- if eq $member $membercode -}} + {{- $wgname | plainify | html -}} + {{- end -}} + {{- end -}} + {{- end -}} + {{ end }} + + {{- .Content | plainify | html -}} + + {{- end -}} + +