impovements to authors display

This commit is contained in:
Nuno Coração 2022-10-29 16:53:27 +01:00
parent dce219e75b
commit a336ae0261
7 changed files with 59 additions and 63 deletions

View file

@ -32,16 +32,16 @@ _Note: the key in the social object will be used to fetch one of the themes i
"name": "Nuno Coração",
"image" : "img/nuno_avatar.jpg",
"bio": "Theme Creator",
"social": {
"linkedin": "https://linkedin.com/in/nunocoracao",
"twitter": "https://twitter.com/nunocoracao",
"instagram": "https://instagram.com/nunocoracao",
"medium": "https://medium.com/@nunocoracao",
"github": "https://github.com/nunocoracao",
"goodreads": "http://goodreads.com/nunocoracao",
"keybase": "https://keybase.io/nunocoracao",
"reddit": "https://reddit.com/user/nunoheart"
}
"social": [
{ "linkedin": "https://linkedin.com/in/nunocoracao" },
{ "twitter": "https://twitter.com/nunocoracao" },
{ "instagram": "https://instagram.com/nunocoracao" },
{ "medium": "https://medium.com/@nunocoracao" },
{ "github": "https://github.com/nunocoracao" },
{ "goodreads": "http://goodreads.com/nunocoracao" },
{ "keybase": "https://keybase.io/nunocoracao" },
{ "reddit": "https://reddit.com/user/nunoheart" }
]
}
```
@ -99,4 +99,4 @@ Nuno's awesome dummy bio.
This sample sample below shows an example where the default site author is turned off and the article has multiple authors.
{{< article link="/blowfish/samples/multiple-authors/" >}}
{{< article link="/samples/multiple-authors/" >}}

View file

@ -2,14 +2,14 @@
"name": "Nuno Coração",
"image" : "img/nuno_avatar.jpg",
"bio": "Theme Creator",
"social": {
"linkedin": "https://linkedin.com/in/nunocoracao",
"twitter": "https://twitter.com/nunocoracao",
"instagram": "https://instagram.com/nunocoracao",
"medium": "https://medium.com/@nunocoracao",
"github": "https://github.com/nunocoracao",
"goodreads": "http://goodreads.com/nunocoracao",
"keybase": "https://keybase.io/nunocoracao",
"reddit": "https://reddit.com/user/nunoheart"
}
"social": [
{ "linkedin": "https://linkedin.com/in/nunocoracao" },
{ "twitter": "https://twitter.com/nunocoracao" },
{ "instagram": "https://instagram.com/nunocoracao" },
{ "medium": "https://medium.com/@nunocoracao" },
{ "github": "https://github.com/nunocoracao" },
{ "goodreads": "http://goodreads.com/nunocoracao" },
{ "keybase": "https://keybase.io/nunocoracao" },
{ "reddit": "https://reddit.com/user/nunoheart" }
]
}

View file

@ -2,14 +2,14 @@
"name": "Dummy Second Author",
"image" : "img/author2.png",
"bio": "Dummy",
"social": {
"linkedin": "https://linkedin.com/in/nunocoracao",
"twitter": "https://twitter.com/nunocoracao",
"instagram": "https://instagram.com/nunocoracao",
"medium": "https://medium.com/@nunocoracao",
"github": "https://github.com/nunocoracao",
"goodreads": "http://goodreads.com/nunocoracao",
"keybase": "https://keybase.io/nunocoracao",
"reddit": "https://reddit.com/user/nunoheart"
}
"social": [
{ "linkedin": "https://linkedin.com/in/nunocoracao" },
{ "twitter": "https://twitter.com/nunocoracao" },
{ "instagram": "https://instagram.com/nunocoracao" },
{ "medium": "https://medium.com/@nunocoracao" },
{ "github": "https://github.com/nunocoracao" },
{ "goodreads": "http://goodreads.com/nunocoracao" },
{ "keybase": "https://keybase.io/nunocoracao" },
{ "reddit": "https://reddit.com/user/nunoheart" }
]
}

View file

@ -1,27 +1,27 @@
{{ $articleClasses := "flex flex-wrap article" }}
{{ if .Site.Params.list.showCards }}
{{ $articleClasses = delimit (slice $articleClasses "border" "border-neutral-200 dark:border-neutral-700 border-2 rounded-md") " " }}
{{ $articleClasses = delimit (slice $articleClasses "border" "border-neutral-200 dark:border-neutral-700 border-2 rounded-md") " " }}
{{ end }}
{{ $articleImageClasses := "w-full md:w-auto h-full thumbnail nozoom" }}
{{ if .Site.Params.list.showCards }}
{{ $articleImageClasses = delimit (slice $articleImageClasses "") " " }}
{{ $articleImageClasses = delimit (slice $articleImageClasses "") " " }}
{{ else }}
{{ $articleImageClasses = delimit (slice $articleImageClasses "thumbnailshadow md:mr-7") " " }}
{{ $articleImageClasses = delimit (slice $articleImageClasses "thumbnailshadow md:mr-7") " " }}
{{ end }}
{{ $articleInnerClasses := "" }}
{{ if .Site.Params.list.showCards }}
{{ $articleInnerClasses = delimit (slice $articleInnerClasses "p-4") " " }}
{{ $articleInnerClasses = delimit (slice $articleInnerClasses "p-4") " " }}
{{ else }}
{{ $articleInnerClasses = delimit (slice $articleInnerClasses "mt-3 md:mt-0") " " }}
{{ $articleInnerClasses = delimit (slice $articleInnerClasses "mt-3 md:mt-0") " " }}
{{ end }}
{{ with .Params.externalUrl }}
<a class="{{ $articleClasses }}" href="{{ . }}" target="_blank" rel="external">
{{ else }}
<a class="{{ $articleClasses }}" href="{{ .RelPermalink }}">
{{ end }}
{{ else }}
<a class="{{ $articleClasses }}" href="{{ .RelPermalink }}">
{{ end }}
{{- with $.Params.images -}}
{{- range first 6 . }}
<meta property="og:image" content="{{ . | absURL }}" />{{ end -}}
@ -30,9 +30,9 @@
{{- $featured := $images.GetMatch "*feature*" -}}
{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
{{- with $featured -}}
{{ with .Resize "600x" }}
{{ with .Resize "600x" }}
<div class="{{ $articleImageClasses }}" style="background-image:url({{ .RelPermalink }});"></div>
{{ end }}
{{ end }}
{{- else -}}
{{- with $.Site.Params.images }}
<meta property="og:image" content="{{ index . 0 | absURL }}" />{{ end -}}
@ -52,7 +52,6 @@
<span class="ltr:hidden">&#8598;</span>
</span>
</div>
</div>
{{ else }}
<div class="text-neutral-800 decoration-primary-500 hover:underline hover:underline-offset-2 dark:text-neutral"
@ -76,4 +75,4 @@
</div>
{{ end }}
</div>
</a>
</a>

View file

@ -59,6 +59,19 @@
{{ end }}
</div>
{{ if .Params.showAuthorsBadges | default (.Site.Params.article.showAuthorsBadges | default false) }}
<div class="flex flex-row flex-wrap items-center">
{{ range $taxonomy, $terms := .Site.Taxonomies }}
{{ if (eq $taxonomy "authors")}}
{{ if (gt (len ($context.GetTerms $taxonomy)) 0) }}
{{ range $i, $a := $context.GetTerms $taxonomy }}
{{ if not (eq $i 0) }} ,&nbsp; {{ end }} <div style="cursor: pointer;" onclick="window.open({{ $a.RelPermalink }})">{{ $a.LinkTitle }}</div>
{{ end }}
{{ end }}
{{ end }}
{{ end }}
</div>
{{ end }}
{{/* Output taxonomies */}}
{{ if .Params.showTaxonomies | default (.Site.Params.article.showTaxonomies | default false) }}
@ -77,21 +90,4 @@
</div>
{{ end }}
{{ if .Params.showAuthorsBadges | default (.Site.Params.article.showAuthorsBadges | default false) }}
<div class="flex flex-row flex-wrap items-center">
{{ range $taxonomy, $terms := .Site.Taxonomies }}
{{ if (eq $taxonomy "authors")}}
{{ if (gt (len ($context.GetTerms $taxonomy)) 0) }}
{{ range $context.GetTerms $taxonomy }}
<span style="margin-top:0.5rem" class="mr-2" onclick="window.open({{ .RelPermalink }});">
{{ partial "badge.html" .LinkTitle }}
</span>
{{ end }}
{{ end }}
{{ end }}
{{ end }}
</div>
{{ end }}
{{ end }}

View file

@ -22,10 +22,12 @@
{{ end }}
<div class="text-2xl sm:text-lg">
<div class="flex flex-wrap text-neutral-400 dark:text-neutral-500">
{{ range $name, $link := .data.social }}
{{ range .data.social }}
{{ range $name, $link := . }}
<a class="px-1 hover:text-primary-700 dark:hover:text-primary-400" href="{{ $link }}" target="_blank"
aria-label="{{ $name | title }}" rel="me noopener noreferrer">{{ partial "icon.html" $name }}</a>
{{ end }}
{{ end }}
</div>
</div>
</div>

View file

@ -1,7 +1,6 @@
<span>
<button id="likes_button"
style="height: 26px; padding-top: 0px; padding-bottom: 4px; padding-left: 10px; padding-right: 10px"
class="!rounded-md bg-primary-600 px-4 py-2 !text-neutral !no-underline hover:!bg-primary-500 dark:bg-primary-800 dark:hover:!bg-primary-700"
class="rounded-md border border-primary-400 px-1 py-[1px] text-xs font-normal text-primary-700 dark:border-primary-600 dark:text-primary-400"
onclick="process_article()">
<span id="likes_button_heart" style="display:none">{{ partial "icon.html" "heart" }} </span>
<span id="likes_button_emtpty_heart">{{ partial "icon.html" "heart-empty" }}</span>