updated authors to be displayed on top of an article

This commit is contained in:
Nuno Coração 2023-06-29 22:15:39 +01:00
parent 9d8d050cd6
commit 7c6663c348
3 changed files with 60 additions and 56 deletions

View file

@ -6,7 +6,7 @@ description: "Some real-life Blowfish examples."
slug: "users" slug: "users"
tags: ["users", "sample"] tags: ["users", "sample"]
showDate: false showDate: false
showAuthor: true showAuthor: false
showReadingTime: false showReadingTime: false
showEdit: false showEdit: false
layoutBackgroundHeaderSpace: false layoutBackgroundHeaderSpace: false
@ -80,7 +80,8 @@ Real websites that are built with Blowfish.
| [blog.enmanuelmoreira.com](https://blog.enmanuelmoreira.com) | Personal site | | [blog.enmanuelmoreira.com](https://blog.enmanuelmoreira.com) | Personal site |
| [halcyonstraits.com](https://www.halcyonstraits.com/) | Doll photography | | [halcyonstraits.com](https://www.halcyonstraits.com/) | Doll photography |
| [50-nuances-octets.fr](https://www.50-nuances-octets.fr/) | Organization site | | [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 >}} {{< 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). **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).

View file

@ -23,6 +23,40 @@
<div class="mt-1 mb-6 text-base text-neutral-500 dark:text-neutral-400 print:hidden"> <div class="mt-1 mb-6 text-base text-neutral-500 dark:text-neutral-400 print:hidden">
{{ partial "article-meta/basic.html" (dict "context" . "scope" "single") }} {{ partial "article-meta/basic.html" (dict "context" . "scope" "single") }}
</div> </div>
{{ $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 }}
<div class="mb-5"></div>
{{ end }}
</header> </header>
<section class="flex flex-col max-w-full mt-0 prose dark:prose-invert lg:flex-row"> <section class="flex flex-col max-w-full mt-0 prose dark:prose-invert lg:flex-row">
{{ if or (and (.Params.showTableOfContents | default (.Site.Params.article.showTableOfContents | default false)) (in {{ if or (and (.Params.showTableOfContents | default (.Site.Params.article.showTableOfContents | default false)) (in
@ -54,30 +88,6 @@
</section> </section>
<footer class="pt-8 max-w-prose print:hidden"> <footer class="pt-8 max-w-prose print:hidden">
{{ partial "author.html" . }}
{{ $authorsData := .Site.Data.authors }}
{{ $taxonomies := .Site.Taxonomies.authors }}
{{ $baseURL := .Site.BaseURL }}
{{ if not (strings.HasSuffix $baseURL "/") }}
{{ $baseURL = delimit (slice $baseURL "/") "" }}
{{ end }}
{{ range $author := .Page.Params.authors }}
{{ $authorData := index $authorsData $author }}
{{- if $authorData -}}
{{ $taxonomyLink := 0 }}
{{ 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 }}
{{ partial "sharing-links.html" . }} {{ partial "sharing-links.html" . }}

View file

@ -1,16 +1,10 @@
{{ if .Params.showAuthor | default (.Site.Params.article.showAuthor | default true) }} <div class="flex">
<div class="flex">
{{ with .Site.Author.image }} {{ with .Site.Author.image }}
{{ $authorImage := resources.Get . }} {{ $authorImage := resources.Get . }}
{{ if $authorImage }} {{ if $authorImage }}
{{ $authorImage := $authorImage.Fill "192x192" }} {{ $authorImage := $authorImage.Fill "192x192" }}
<img <img class="!mt-0 !mb-0 h-24 w-24 rounded-full ltr:mr-4 rtl:ml-4" width="96" height="96"
class="!mt-0 !mb-0 h-24 w-24 rounded-full ltr:mr-4 rtl:ml-4" alt="{{ $.Site.Author.name | default " Author" }}" src="{{ $authorImage.RelPermalink }}" />
width="96"
height="96"
alt="{{ $.Site.Author.name | default "Author" }}"
src="{{ $authorImage.RelPermalink }}"
/>
{{ end }} {{ end }}
{{ end }} {{ end }}
<div class="place-self-center"> <div class="place-self-center">
@ -27,5 +21,4 @@
{{ end }} {{ end }}
<div class="text-2xl sm:text-lg">{{ partialCached "author-links.html" . }}</div> <div class="text-2xl sm:text-lg">{{ partialCached "author-links.html" . }}</div>
</div> </div>
</div> </div>
{{ end }}