From a2c2f3051ade123b690286c06772ff664d9bf9db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20K=C3=BCrten?= <sebastian@mobanisto.de> Date: Fri, 27 Jan 2023 11:09:26 +0100 Subject: [PATCH] Allow multiple news items on front page --- themes/briar/layouts/_default/list.html | 6 ++++-- themes/briar/layouts/partials/header.html | 3 +-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/themes/briar/layouts/_default/list.html b/themes/briar/layouts/_default/list.html index f443721..817139e 100644 --- a/themes/briar/layouts/_default/list.html +++ b/themes/briar/layouts/_default/list.html @@ -2,9 +2,11 @@ <h2>{{ with .Title }} {{ . }} {{ else }} {{ .Site.Title }} {{ end }}</h2> <p><strong>Latest Release:</strong> Briar {{ .Params.releaseVersion }} ({{ .Params.releaseDate }})</p> <p><strong>Latest News:</strong> -{{ range first 1 (where .Site.RegularPages "Section" "news").ByDate.Reverse }} +{{ $num := 3 }} +{{ range $k, $v := first $num (where .Site.RegularPages "Section" "news").ByDate.Reverse }} <a href="{{.Permalink}}">{{.Title}}</a> -</p> + {{- if (lt $k (sub $num 1)) }} ~ {{ end }} {{ end }} +</p> {{ .Content }} {{ end }} diff --git a/themes/briar/layouts/partials/header.html b/themes/briar/layouts/partials/header.html index 3a26f2f..de52964 100644 --- a/themes/briar/layouts/partials/header.html +++ b/themes/briar/layouts/partials/header.html @@ -29,8 +29,7 @@ <ul id="menu"> {{ $currentPage := . }} {{ range .Site.Menus.main }} - {{ $menu_item_url - := .URL | relLangURL }} + {{ $menu_item_url := .URL | relLangURL }} {{ $page_url:= $currentPage.RelPermalink | relLangURL }} <li> <a {{ if eq $menu_item_url $page_url }}id="is-active" {{end}} -- GitLab