mirror of
https://github.com/nunocoracao/blowfish.git
synced 2025-02-02 11:32:30 -06:00
✨Term add likes and views
This commit is contained in:
parent
f4b5413c05
commit
8b132ffa0e
3 changed files with 47 additions and 0 deletions
|
@ -96,6 +96,7 @@ enableCodeCopy = true
|
||||||
[term]
|
[term]
|
||||||
#showHero = true
|
#showHero = true
|
||||||
#heroStyle = "background" # valid options: basic, big, background, thumbAndBackground
|
#heroStyle = "background" # valid options: basic, big, background, thumbAndBackground
|
||||||
|
#showSummary = false
|
||||||
#showViews = false
|
#showViews = false
|
||||||
#showLikes = false
|
#showLikes = false
|
||||||
#showTableOfContents = true
|
#showTableOfContents = true
|
||||||
|
|
|
@ -4,12 +4,22 @@
|
||||||
{{ partial "breadcrumbs.html" . }}
|
{{ partial "breadcrumbs.html" . }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<h1 class="mt-0 text-4xl font-extrabold text-neutral-900 dark:text-neutral">{{ .Title }}</h1>
|
<h1 class="mt-0 text-4xl font-extrabold text-neutral-900 dark:text-neutral">{{ .Title }}</h1>
|
||||||
|
<div class="mt-1 mb-2 text-base text-neutral-500 dark:text-neutral-400 print:hidden">
|
||||||
|
{{ partial "article-meta-term.html" (dict "context" . "scope" "single") }}
|
||||||
|
</div>
|
||||||
</header>
|
</header>
|
||||||
{{ if .Content }}
|
{{ if .Content }}
|
||||||
<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">
|
||||||
<div class="min-w-0 min-h-0 max-w-prose">
|
<div class="min-w-0 min-h-0 max-w-prose">
|
||||||
{{ .Content | emojify }}
|
{{ .Content | emojify }}
|
||||||
</div>
|
</div>
|
||||||
|
<script>
|
||||||
|
var oid = "views_{{ .File.Path }}"
|
||||||
|
var oid_likes = "likes_{{ .File.Path }}"
|
||||||
|
</script>
|
||||||
|
{{ $jsPage := resources.Get "js/page.js" }}
|
||||||
|
{{ $jsPage = $jsPage | resources.Minify | resources.Fingerprint "sha512" }}
|
||||||
|
<script type="text/javascript" src="{{ $jsPage.RelPermalink }}" integrity="{{ $jsPage.Data.Integrity }}"></script>
|
||||||
</section>
|
</section>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<section class="mt-5 space-y-10 w-full">
|
<section class="mt-5 space-y-10 w-full">
|
||||||
|
|
36
layouts/partials/article-meta-term.html
Normal file
36
layouts/partials/article-meta-term.html
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
{{/* Determine the correct context and scope */}}
|
||||||
|
{{/* This allows for different logic depending on where the partial is called */}}
|
||||||
|
{{ $context := . }}
|
||||||
|
{{ $scope := default nil }}
|
||||||
|
|
||||||
|
{{ if (reflect.IsMap . ) }}
|
||||||
|
{{ $context = .context }}
|
||||||
|
{{ $scope = cond (not .scope) nil .scope }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ with $context }}
|
||||||
|
{{ $meta := newScratch }}
|
||||||
|
|
||||||
|
{{/* Gather partials for this context */}}
|
||||||
|
|
||||||
|
{{ if (.Params.showViews | default (.Site.Params.term.showViews | default false)) }}
|
||||||
|
{{ $meta.Add "partials" (slice (partial "meta/views.html" .)) }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ if (.Params.showLikes | default (.Site.Params.term.showLikes | default false)) }}
|
||||||
|
{{ $meta.Add "partials" (slice (partial "meta/likes.html" .)) }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ if and (eq $scope "single") (.Params.showLikes | default (.Site.Params.term.showLikes | default false)) }}
|
||||||
|
{{ $meta.Add "partials" (slice (partial "meta/likes_button.html" .)) }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
|
||||||
|
<div class="flex flex-row flex-wrap items-center">
|
||||||
|
{{/* Output partials */}}
|
||||||
|
{{ with ($meta.Get "partials") }}
|
||||||
|
{{ delimit . "<span class=\"px-2 text-primary-500\">·</span>" }}
|
||||||
|
{{ end }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{ end }}
|
Loading…
Reference in a new issue