From f9aaac85a069e662a4d52352f9c51b360b3b13b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=B6ran=20S?= Date: Fri, 31 Aug 2018 19:08:15 +0200 Subject: Modify author link --- layouts/partials/category.html | 28 +++++++++++++++++++++------- layouts/partials/portfolio.html | 18 ++++++++++++++---- 2 files changed, 35 insertions(+), 11 deletions(-) diff --git a/layouts/partials/category.html b/layouts/partials/category.html index ac014c3..e392161 100644 --- a/layouts/partials/category.html +++ b/layouts/partials/category.html @@ -13,6 +13,15 @@

Posts

{{ range $index, $element := (where .Data.Pages "Section" "post") }} + + {{ $scratch := newScratch }} + {{ if .Site.Params.writers }} + {{ $scratch.Set "writer" (index .Site.Params.writers (lower .Params.writer) | default dict) }} + {{ else }} + {{ $scratch.Set "writer" .Site.Params.social | default dict }} + {{ end }} + {{ $writer := $scratch.Get "writer" }} + {{ if and (isset .Params "image") .Params.image }} {{ if eq (mod $index 2) 0 }}
@@ -29,18 +38,23 @@
- {{ .Date.Format "02 January" }} / + {{ .Date.Format "02 January" }} + - {{ if and (isset .Site.Params "author") .Site.Params.author }} - {{ if and (isset .Site.Params "authorlink") .Site.Params.authorLink }} - + {{ if and (isset .Site.Params "author") .Site.Params.author }} + / + + + + {{ end }} {{ else }} - {{ .Site.Params.author | default "" }} + + {{ .Params.writer | default .Site.Params.author }} + {{ end }} - - {{ end }} + {{ range .Params.categories }} / diff --git a/layouts/partials/portfolio.html b/layouts/partials/portfolio.html index 4db2f15..cbaaad4 100644 --- a/layouts/partials/portfolio.html +++ b/layouts/partials/portfolio.html @@ -9,7 +9,7 @@ {{ else }} {{ $scratch.Set "writer" .Site.Params.social | default dict }} {{ end }} - {{ $writer := $scratch.Get "writer" }} + {{ $writer := $scratch.Get "writer" }} {{ if and (isset .Params "image") .Params.image }} {{ if eq (mod $index 2) 0 }}
@@ -28,12 +28,22 @@ {{ end }}
- {{ .Date.Format "02 January" }} / - + {{ .Date.Format "02 January" }} + {{ if and (isset .Site.Params "authorlink") .Site.Params.authorLink }} + {{ if and (isset .Site.Params "author") .Site.Params.author }} + / + + + + {{ end }} + {{ else }} - + {{ .Params.writer | default .Site.Params.author }} + {{ end }} + + {{ range .Params.categories }} / -- cgit v1.2.3