Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/wangchucheng/hugo-eureka.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHerbert <30955264+HerbertHe@users.noreply.github.com>2021-04-18 20:40:10 +0300
committerGitHub <noreply@github.com>2021-04-18 20:40:10 +0300
commit1762613dfb06a9f2fb0958b4550234ea7193b772 (patch)
tree012b91f92ed81ceff3d57779bda9edbe1ea118ae
parent177e4b19c294652a163cf93d35fdc5ae91acf3e3 (diff)
feat: support Valine (#79)
* feat: support valine * ui: impove valine UI * feat: support valine options * fix: remove valine serverURLs option * refactor: load params in a more flexible way * feat: custom editThisPage repo branch * cRevert "feat: custom editThisPage repo branch" This reverts commit 36923ac30de6c3a690fa7407e534c5395bafcb18. Co-authored-by: Wang Chucheng <me@wangchucheng.com>
-rw-r--r--data/assets.yaml9
-rw-r--r--exampleSite/config/_default/params.yaml12
-rw-r--r--layouts/partials/comment/valine.html14
3 files changed, 32 insertions, 3 deletions
diff --git a/data/assets.yaml b/data/assets.yaml
index ba1e3e1..4768224 100644
--- a/data/assets.yaml
+++ b/data/assets.yaml
@@ -35,4 +35,11 @@ mermaid:
version: 8.9.2
js:
url: https://cdn.jsdelivr.net/npm/mermaid@%s/dist/mermaid.min.js
- sri: sha256-Zmpaaj+GXFsPF5WdPArSrnW3b30dovldeKsW00xBVwE= \ No newline at end of file
+ sri: sha256-Zmpaaj+GXFsPF5WdPArSrnW3b30dovldeKsW00xBVwE=
+
+# Valine
+valine:
+ version: 1.4.14
+ js:
+ url: https://cdn.jsdelivr.net/npm/valine@%s/dist/Valine.min.js
+ sri: sha256-fPqMAsW3FDt/rNyneSJ7HOpZNRs/O2rM016SU08JtCk=
diff --git a/exampleSite/config/_default/params.yaml b/exampleSite/config/_default/params.yaml
index 5eaeaf2..16e5093 100644
--- a/exampleSite/config/_default/params.yaml
+++ b/exampleSite/config/_default/params.yaml
@@ -19,7 +19,7 @@ publisherLogo:
highlight:
handler: highlightjs
-
+
highlightjs:
# highlight.js doesn't bundle every language. So please specify additional languages you want here.
# See https://github.com/highlightjs/cdn-release/tree/master/build/languages for available languages.
@@ -40,7 +40,7 @@ math:
# leqno:
comment:
- # Options: disqus, commento and utterances.
+ # Options: disqus, commento, valine and utterances.
handler:
# disqus:
@@ -57,6 +57,14 @@ comment:
# # If self-hosting, please enter the url (e.g. https://commento.example.com) here. Otherwise leave empty.
# url:
+ valine:
+ # Browse https://valine.js.org/configuration.html to see the options available.
+ # You can list the key and value you want as below.
+ # Because Hugo's config params are case-insensitive, you need to add `-` or `_` before the uppercase letters.
+ # For example, `appId` should be written as `app-Id` or other acceptable formats.
+ app-Id:
+ app-Key:
+
diagram:
handler: mermaid
diff --git a/layouts/partials/comment/valine.html b/layouts/partials/comment/valine.html
new file mode 100644
index 0000000..7a5a7ce
--- /dev/null
+++ b/layouts/partials/comment/valine.html
@@ -0,0 +1,14 @@
+<div id="valine-comments" class="mt-4"></div>
+{{- $assets := .Site.Data.assets }}
+<script defer src="{{ printf $assets.valine.js.url $assets.valine.version }}" {{ with $assets.valine.js.sri }}
+ integrity="{{ . }}" {{ end }} crossorigin></script>
+{{- with .Site.Params.comment.valine }}
+<script>
+ document.addEventListener("DOMContentLoaded", function () {
+ new Valine({
+ el: "#valine-comments",
+ {{- partial "utils/get-js-configs" . | safeJS }}
+ })
+ });
+</script>
+{{- end }} \ No newline at end of file