From 7c6663c3485664960cc67b48c10592893bc61795 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20Cora=C3=A7=C3=A3o?= Date: Thu, 29 Jun 2023 22:15:39 +0100 Subject: [PATCH] updated authors to be displayed on top of an article --- exampleSite/content/users/index.md | 5 ++- layouts/_default/single.html | 60 +++++++++++++++++------------- layouts/partials/author.html | 51 +++++++++++-------------- 3 files changed, 60 insertions(+), 56 deletions(-) diff --git a/exampleSite/content/users/index.md b/exampleSite/content/users/index.md index 46c4b8d95..fdf34b4f2 100644 --- a/exampleSite/content/users/index.md +++ b/exampleSite/content/users/index.md @@ -6,7 +6,7 @@ description: "Some real-life Blowfish examples." slug: "users" tags: ["users", "sample"] showDate: false -showAuthor: true +showAuthor: false showReadingTime: false showEdit: false layoutBackgroundHeaderSpace: false @@ -80,7 +80,8 @@ Real websites that are built with Blowfish. | [blog.enmanuelmoreira.com](https://blog.enmanuelmoreira.com) | Personal site | | [halcyonstraits.com](https://www.halcyonstraits.com/) | Doll photography | | [50-nuances-octets.fr](https://www.50-nuances-octets.fr/) | Organization site | -| [marupanda.art/marucomics][https://marupanda.art/marucomics/] | Comics site | +| [marupanda.art/marucomics](https://marupanda.art/marucomics/) | Comics site | + {{< alert >}} **Blowfish user?** To add your site to this list, [submit a pull request](https://github.com/nunocoracao/blowfish/blob/main/exampleSite/content/users/index.md). diff --git a/layouts/_default/single.html b/layouts/_default/single.html index de0f3a887..60f58bc48 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -23,6 +23,40 @@

{{ partial "article-meta/basic.html" (dict "context" . "scope" "single") }}
+ + {{ $authorsData := .Site.Data.authors }} + {{ $taxonomies := .Site.Taxonomies.authors }} + {{ $baseURL := .Site.BaseURL }} + {{ $taxonomyLink := 0 }} + {{ $showAuthor := 0 }} + + {{ if .Params.showAuthor | default (.Site.Params.article.showAuthor | default true) }} + {{ $showAuthor = 1 }} + {{ partial "author.html" . }} + {{ end }} + + {{ if not (strings.HasSuffix $baseURL "/") }} + {{ $baseURL = delimit (slice $baseURL "/") "" }} + {{ end }} + + {{ range $author := .Page.Params.authors }} + {{ $authorData := index $authorsData $author }} + {{- if $authorData -}} + + {{ range $taxonomyname, $taxonomy := $taxonomies }} + {{ if (eq $taxonomyname $author) }} + {{ $taxonomyLink = delimit (slice $baseURL "/authors/" $author) "" }} + {{ end }} + {{ end }} + + {{ partial "author-extra.html" (dict "context" . "data" $authorData "link" $taxonomyLink) }} + {{- end -}} + {{ end }} + + {{ if or $taxonomyLink $showAuthor }} +
+ {{ end }} +
{{ if or (and (.Params.showTableOfContents | default (.Site.Params.article.showTableOfContents | default false)) (in @@ -54,31 +88,7 @@