fixed problem with likes/views rendering

This commit is contained in:
Nuno Coração 2024-04-07 19:25:42 +01:00
parent 756d07aa80
commit 6daf41ed2b
2 changed files with 32 additions and 28 deletions

View file

@ -1,19 +1,22 @@
<span>
{{ $id := "null" }}
{{ if eq .Kind "taxonomy" }}
<span id="likes_taxonomy_{{ .Page.Data.Plural }}">
{{ $id = delimit (slice "likes_taxonomy_" .Page.Data.Plural) "" }}
{{ else if eq .Kind "term" }}
<span id="likes_term_{{ .Page.Data.Term }}">
{{ $id = delimit (slice "likes_term_" .Page.Data.Term) "" }}
{{ else }}
{{ $translations := .AllTranslations }}
{{ with .File }}
{{ $path := .Path }}
{{range $translations}}
{{ $lang := print "." .Lang ".md" }}
{{ $path = replace $path $lang ".md" }}
{{end}}
<span id="likes_{{ $path }}">
{{ end }}
{{ $translations := .AllTranslations }}
{{ with .File }}
{{ $path := .Path }}
{{range $translations}}
{{ $lang := print "." .Lang ".md" }}
{{ $path = replace $path $lang ".md" }}
{{end}}
{{ $id = delimit (slice "likes_" $path) "" }}
{{ end }}
{{ end }}
class="animate-pulse inline-block text-transparent max-h-3 rounded-full mt-[-2px] align-middle bg-neutral-300 dark:bg-neutral-400" title="likes">loading</span>
<span id="{{ $id }}"
class="animate-pulse inline-block text-transparent max-h-3 rounded-full mt-[-2px] align-middle bg-neutral-300 dark:bg-neutral-400"
title="likes">loading</span>
<span class="inline-block align-text-bottom">{{ partial "icon.html" "heart" }}</span>
</span>

View file

@ -1,19 +1,20 @@
<span>
{{ if eq .Kind "taxonomy" }}
<span id="views_taxonomy_{{ .Page.Data.Plural }}">
{{ else if eq .Kind "term" }}
<span id="views_term_{{ .Page.Data.Term }}">
{{ else }}
{{ $translations := .AllTranslations }}
{{ with .File }}
{{ $path := .Path }}
{{range $translations}}
{{ $lang := print "." .Lang ".md" }}
{{ $path = replace $path $lang ".md" }}
{{end}}
<span id="views_{{ $path }}">
{{ end }}
{{ $id := "null" }}
{{ if eq .Kind "taxonomy" }}
{{ $id = delimit (slice "views_taxonomy_" .Page.Data.Plural) "" }}
{{ else if eq .Kind "term" }}
{{ $id = delimit (slice "views_term_" .Page.Data.Term) "" }}
{{ else }}
{{ $translations := .AllTranslations }}
{{ with .File }}
{{ $path := .Path }}
{{range $translations}}
{{ $lang := print "." .Lang ".md" }}
{{ $path = replace $path $lang ".md" }}
{{end}}
{{ $id = delimit (slice "views_" $path) "" }}
{{ end }}
class="animate-pulse inline-block text-transparent max-h-3 rounded-full mt-[-2px] align-middle bg-neutral-300 dark:bg-neutral-400" title="views">loading</span>
<span class="inline-block align-text-bottom">{{ partial "icon.html" "eye" }}</span>
{{ end }}
<span id="{{ $id }}" class="animate-pulse inline-block text-transparent max-h-3 rounded-full mt-[-2px] align-middle bg-neutral-300 dark:bg-neutral-400" title="views">loading</span>
<span class="inline-block align-text-bottom">{{ partial "icon.html" "eye" }}</span>
</span>