From 537c86aa991bba4fd6508de4d20b75ce9c30ff14 Mon Sep 17 00:00:00 2001 From: akwizgran <michael@briarproject.org> Date: Tue, 29 Mar 2022 11:38:23 +0100 Subject: [PATCH] Use a separate layout for news pages, use configurable author name. --- config.yaml | 2 +- themes/briar/layouts/_default/section.html | 17 ++------------- themes/briar/layouts/_default/single.html | 10 --------- themes/briar/layouts/news/section.html | 24 ++++++++++++++++++++++ themes/briar/layouts/news/single.html | 12 +++++++++++ 5 files changed, 39 insertions(+), 26 deletions(-) create mode 100644 themes/briar/layouts/news/section.html create mode 100644 themes/briar/layouts/news/single.html diff --git a/config.yaml b/config.yaml index 6ec6da0..d28d8a2 100644 --- a/config.yaml +++ b/config.yaml @@ -11,7 +11,7 @@ Params: flatterid: 4pq200 Author: - name: Briar Team + name: The Briar Team # String to hex encoder: http://www.wbwip.com/wbw/emailencoder.html main: - identifier: torsten diff --git a/themes/briar/layouts/_default/section.html b/themes/briar/layouts/_default/section.html index d7703a8..b59ec48 100644 --- a/themes/briar/layouts/_default/section.html +++ b/themes/briar/layouts/_default/section.html @@ -1,24 +1,11 @@ {{ define "main" }} - <h1>{{ with .Title }} {{ . }} {{ else }} {{ .Site.Title }} {{ end }} {{ if (eq .Type "news") }} <a href="/news/index.xml"> <img src="/img/rss-icon.png" class="rss-icon"/></a> {{ end }} </h1> + <h1>{{ with .Title }} {{ . }} {{ else }} {{ .Site.Title }} {{ end }}</h1> {{ .Content }} {{ range .Pages.ByDate.Reverse }} {{ if not .Params.hide }} - <h3 itemprop="headline" class="blog-post-title"> + <h3 itemprop="headline"> <a href="{{.Permalink}}">{{.Title}}</a> </h3> - <p class="blog-post-meta"> - {{.Date.Format "January 2, 2006"}} by - {{ if (isset .Params "author") }} - {{ markdownify .Params.author }} - {{ else }} - The Briar Team - {{ end }} - </p> - <div> - {{ .Summary | safeHTML | truncate 250 }} - <a href='{{ .Permalink }}'><nobr>Read more →</nobr></a> - </div> - <hr/> {{ end }} {{ end }} {{ end }} diff --git a/themes/briar/layouts/_default/single.html b/themes/briar/layouts/_default/single.html index d3002cb..e22c3a1 100644 --- a/themes/briar/layouts/_default/single.html +++ b/themes/briar/layouts/_default/single.html @@ -1,14 +1,4 @@ {{ define "main" }} <h2>{{ .Title }}</h2> -<p> - {{ if (eq .Type "news") }} - {{.Date.Format "January 2, 2006"}} by - {{ if (isset .Params "author") }} - {{ markdownify .Params.author }} - {{ else }} - The Briar Team - {{ end }} - {{ end }} -</p> {{ .Content }} {{ end }} diff --git a/themes/briar/layouts/news/section.html b/themes/briar/layouts/news/section.html new file mode 100644 index 0000000..7e2c3ee --- /dev/null +++ b/themes/briar/layouts/news/section.html @@ -0,0 +1,24 @@ +{{ define "main" }} + <h1>{{ with .Title }} {{ . }} {{ else }} {{ .Site.Title }} {{ end }} <a href="/news/index.xml"> <img src="/img/rss-icon.png" class="rss-icon"/></a> </h1> + {{ .Content }} + {{ range .Pages.ByDate.Reverse }} + {{ if not .Params.hide }} + <h3 itemprop="headline" class="blog-post-title"> + <a href="{{.Permalink}}">{{.Title}}</a> + </h3> + <p class="blog-post-meta"> + {{.Date.Format "January 2, 2006"}} by + {{ if (isset .Params "author") }} + {{ markdownify .Params.author }} + {{ else }} + {{ .Site.Author.name }} + {{ end }} + </p> + <div> + {{ .Summary | safeHTML | truncate 250 }} + <a href='{{ .Permalink }}'><nobr>Read more →</nobr></a> + </div> + <hr/> + {{ end }} + {{ end }} +{{ end }} diff --git a/themes/briar/layouts/news/single.html b/themes/briar/layouts/news/single.html new file mode 100644 index 0000000..135199f --- /dev/null +++ b/themes/briar/layouts/news/single.html @@ -0,0 +1,12 @@ +{{ define "main" }} +<h2>{{ .Title }}</h2> +<p> + {{.Date.Format "January 2, 2006"}} by + {{ if (isset .Params "author") }} + {{ markdownify .Params.author }} + {{ else }} + {{ .Site.Author.name }} + {{ end }} +</p> +{{ .Content }} +{{ end }} -- GitLab