Merge pull request #56 from nunocoracao/55-taxonomy-badges-broken-in-mobile

fixed badges for taxonomies
This commit is contained in:
Nuno Coração 2022-10-02 01:03:43 +01:00 committed by GitHub
commit 79bed0ae62
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 63 additions and 57 deletions

View file

@ -4,48 +4,50 @@
{{ $scope := default nil }} {{ $scope := default nil }}
{{ if (reflect.IsMap . ) }} {{ if (reflect.IsMap . ) }}
{{ $context = .context }} {{ $context = .context }}
{{ $scope = cond (not .scope) nil .scope }} {{ $scope = cond (not .scope) nil .scope }}
{{ end }} {{ end }}
{{ with $context }} {{ with $context }}
{{ $meta := newScratch }} {{ $meta := newScratch }}
{{/* Gather partials for this context */}} {{/* Gather partials for this context */}}
{{ if .Params.showDate | default (.Site.Params.article.showDate | default true) }} {{ if .Params.showDate | default (.Site.Params.article.showDate | default true) }}
{{ $meta.Add "partials" (slice (partial "meta/date.html" .Date)) }} {{ $meta.Add "partials" (slice (partial "meta/date.html" .Date)) }}
{{ end }} {{ end }}
{{ if and (.Params.showDateUpdated | default (.Site.Params.article.showDateUpdated | default false)) (ne (partial "functions/date.html" .Date) (partial "functions/date.html" .Lastmod)) }} {{ if and (.Params.showDateUpdated | default (.Site.Params.article.showDateUpdated | default false)) (ne (partial
{{ $meta.Add "partials" (slice (partial "meta/date-updated.html" .Lastmod)) }} "functions/date.html" .Date) (partial "functions/date.html" .Lastmod)) }}
{{ end }} {{ $meta.Add "partials" (slice (partial "meta/date-updated.html" .Lastmod)) }}
{{ end }}
{{ if and (.Params.showWordCount | default (.Site.Params.article.showWordCount | default false)) (ne .WordCount 0) }} {{ if and (.Params.showWordCount | default (.Site.Params.article.showWordCount | default false)) (ne .WordCount 0) }}
{{ $meta.Add "partials" (slice (partial "meta/word-count.html" .)) }} {{ $meta.Add "partials" (slice (partial "meta/word-count.html" .)) }}
{{ end }} {{ end }}
{{ if and (.Params.showReadingTime | default (.Site.Params.article.showReadingTime | default true)) (ne .ReadingTime 0) }} {{ if and (.Params.showReadingTime | default (.Site.Params.article.showReadingTime | default true)) (ne .ReadingTime 0)
{{ $meta.Add "partials" (slice (partial "meta/reading-time.html" .)) }} }}
{{ end }} {{ $meta.Add "partials" (slice (partial "meta/reading-time.html" .)) }}
{{ end }}
{{ if (.Params.showViews | default (.Site.Params.article.showViews | default false)) }} {{ if (.Params.showViews | default (.Site.Params.article.showViews | default false)) }}
{{ $meta.Add "partials" (slice (partial "meta/views.html" .)) }} {{ $meta.Add "partials" (slice (partial "meta/views.html" .)) }}
{{ end }} {{ end }}
{{ if (.Params.showLikes | default (.Site.Params.article.showLikes | default false)) }} {{ if (.Params.showLikes | default (.Site.Params.article.showLikes | default false)) }}
{{ $meta.Add "partials" (slice (partial "meta/likes.html" .)) }} {{ $meta.Add "partials" (slice (partial "meta/likes.html" .)) }}
{{ end }} {{ end }}
{{ if and (eq $scope "single") (.Params.showLikes | default (.Site.Params.article.showLikes | default false)) }} {{ if and (eq $scope "single") (.Params.showLikes | default (.Site.Params.article.showLikes | default false)) }}
{{ $meta.Add "partials" (slice (partial "meta/likes_button.html" .)) }} {{ $meta.Add "partials" (slice (partial "meta/likes_button.html" .)) }}
{{ end }} {{ end }}
{{ if and (eq $scope "single") (.Params.showEdit | default (.Site.Params.article.showEdit | default false)) }} {{ if and (eq $scope "single") (.Params.showEdit | default (.Site.Params.article.showEdit | default false)) }}
{{ $meta.Add "partials" (slice (partial "meta/edit.html" .)) }} {{ $meta.Add "partials" (slice (partial "meta/edit.html" .)) }}
{{ end }} {{ end }}
<div class="flex flex-row flex-wrap items-center"> <div class="flex flex-row flex-wrap items-center">
{{/* Output partials */}} {{/* Output partials */}}
{{ with ($meta.Get "partials") }} {{ with ($meta.Get "partials") }}
{{ delimit . "<span class=\"px-2 text-primary-500\">&middot;</span>" }} {{ delimit . "<span class=\"px-2 text-primary-500\">&middot;</span>" }}
@ -56,20 +58,24 @@
<span class="pl-2">{{ partial "badge.html" (i18n "article.draft" | emojify) }}</span> <span class="pl-2">{{ partial "badge.html" (i18n "article.draft" | emojify) }}</span>
{{ end }} {{ end }}
{{/* Output taxonomies */}}
{{ if .Params.showTaxonomies | default (.Site.Params.article.showTaxonomies | default false) }} {{ end }}
</div>
{{/* Output taxonomies */}}
{{ if .Params.showTaxonomies | default (.Site.Params.article.showTaxonomies | default false) }}
<div class="flex flex-row flex-wrap items-center">
{{ range $taxonomy, $terms := .Site.Taxonomies }} {{ range $taxonomy, $terms := .Site.Taxonomies }}
{{ if (gt (len ($context.GetTerms $taxonomy)) 0) }} {{ if (gt (len ($context.GetTerms $taxonomy)) 0) }}
{{ range $context.GetTerms $taxonomy }} {{ range $context.GetTerms $taxonomy }}
<span class="pl-2" onclick="window.open({{ .RelPermalink }});"> <span style="margin-top:0.5rem" class="mr-2" onclick="window.open({{ .RelPermalink }});">
{{ partial "badge.html" .LinkTitle }} {{ partial "badge.html" .LinkTitle }}
</span> </span>
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ end }} </div>
{{ end }} {{ end }}
</div>

View file

@ -1,6 +1,6 @@
<span class="flex"> <span class="flex">
<span <span
class="rounded-md border border-primary-400 px-1 py-[1px] text-xs font-normal text-primary-700 ltr:ml-1 rtl:mr-1 dark:border-primary-600 dark:text-primary-400" 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"
> >
{{ . }} {{ . }}
</span> </span>