mirror of
https://github.com/BBaoVanC/bobatheme.git
synced 2025-08-06 07:51:36 -05:00
Add comment counter to page metadata
Also move the Isso script tag from comments.html to the <head>, since it essentially needs to load on all pages. Fixes #94
This commit is contained in:
@@ -12,45 +12,4 @@
|
||||
<i>Enable JavaScript to see the comment section.</i>
|
||||
</noscript>
|
||||
|
||||
{{ $url := .Permalink }}
|
||||
{{ if .IsTranslated }}
|
||||
{{ with index .AllTranslations 0 }}
|
||||
{{ $url = .Permalink }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
|
||||
<script data-isso-id="{{ $url }}"
|
||||
data-isso-default-lang="{{ .Language.Lang }}"
|
||||
data-isso-css="true"
|
||||
data-isso-max-comments-top="inf"
|
||||
data-isso-max-comments-nested="inf"
|
||||
data-isso-reveal-on-click="5"
|
||||
{{/*
|
||||
data-isso-avatar-bg="#111"
|
||||
data-isso-avatar-fg="#9abf88 #5698c4 #e279a3 #9163b6 ..."
|
||||
*/}}
|
||||
data-isso-vote="true"
|
||||
{{/*
|
||||
data-isso-vote-levels=""
|
||||
*/}}
|
||||
data-isso-feed="true"
|
||||
data-isso-require-email="false"
|
||||
data-isso-reply-notifications="true"
|
||||
data-isso-reply-notifications-default-enabled="true"
|
||||
|
||||
{{ with (.GetTerms "authors") }}
|
||||
{{ $authorHashes := slice }}
|
||||
{{ range . }}
|
||||
{{ with .Params.issoUserID }}
|
||||
{{ $authorHashes = $authorHashes | append . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
data-isso-page-author-hashes="{{ delimit $authorHashes "," }}"
|
||||
{{ end }}
|
||||
|
||||
src="https://isso.bbaovanc.com/js/embed.min.js">
|
||||
</script>
|
||||
|
||||
<section id="isso-thread" data-title="{{ .Title }}"></section>
|
||||
|
@@ -23,6 +23,44 @@
|
||||
<script defer src="{{ .Permalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous"></script>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ $isso_url := .Permalink }}
|
||||
{{ if .IsTranslated }}
|
||||
{{ with index .AllTranslations 0 }}
|
||||
{{ $isso_url = .Permalink }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
<script defer src="https://isso.bbaovanc.com/js/embed.min.js"
|
||||
data-isso-id="{{ $isso_url }}"
|
||||
data-isso-default-lang="{{ .Language.Lang }}"
|
||||
data-isso-css="true"
|
||||
data-isso-max-comments-top="inf"
|
||||
data-isso-max-comments-nested="inf"
|
||||
data-isso-reveal-on-click="5"
|
||||
{{/*
|
||||
data-isso-avatar-bg="#111"
|
||||
data-isso-avatar-fg="#9abf88 #5698c4 #e279a3 #9163b6 ..."
|
||||
*/}}
|
||||
data-isso-vote="true"
|
||||
{{/*
|
||||
data-isso-vote-levels=""
|
||||
*/}}
|
||||
data-isso-feed="true"
|
||||
data-isso-require-email="false"
|
||||
data-isso-reply-notifications="true"
|
||||
data-isso-reply-notifications-default-enabled="true"
|
||||
|
||||
{{ with (.GetTerms "authors") }}
|
||||
{{ $authorHashes := slice }}
|
||||
{{ range . }}
|
||||
{{ with .Params.issoUserID }}
|
||||
{{ $authorHashes = $authorHashes | append . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
data-isso-page-author-hashes="{{ delimit $authorHashes "," }}"
|
||||
{{ end }}
|
||||
>
|
||||
</script>
|
||||
|
||||
{{ if eq .Layout "search" }}
|
||||
{{ with resources.Get "css/search.css" | fingerprint "sha512" }}
|
||||
|
@@ -0,0 +1,8 @@
|
||||
<span class="page-metadata-item" aria-label="comments counter">
|
||||
{{ partial "icon.html" "message" }}
|
||||
{{/* TODO: figure out if there's a nicer way to generate this URL
|
||||
* the current issue is that we can't use RelRef, since content view means that we don't
|
||||
* have access to the original page context
|
||||
*/}}
|
||||
<a href="{{ .RelPermalink }}#isso-thread">comments</a>
|
||||
</span>
|
@@ -21,6 +21,7 @@
|
||||
{{ partial "page-metadata/item/readingtime.html" . }}
|
||||
{{ partial "page-metadata/item/edithistory.html" . }}
|
||||
{{ partial "page-metadata/item/viewraw.html" . }}
|
||||
{{ partial "page-metadata/item/comments-counter.html" . }}
|
||||
|
||||
{{ partial "page-metadata/item/categories.html" . }}
|
||||
|
||||
|
@@ -9,6 +9,7 @@
|
||||
|
||||
{{ partial "page-metadata/item/authors.html" . }}
|
||||
{{ partial "page-metadata/item/readingtime.html" . }}
|
||||
{{ partial "page-metadata/item/comments-counter.html" . }}
|
||||
|
||||
{{ partial "page-metadata/item/series.html" . }}
|
||||
{{ partial "page-metadata/item/categories.html" . }}
|
||||
|
Reference in New Issue
Block a user