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

github.com/CaiJimmy/hugo-theme-stack.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhixuan <59254886+zhixuan666@users.noreply.github.com>2021-08-04 21:49:21 +0300
committerGitHub <noreply@github.com>2021-08-04 21:49:21 +0300
commit7b51bea912eeb0a1abf6feb0d81479dd202814f5 (patch)
tree8a16b8a512da77f11aaf74e32da23c5e0c1f99f8
parent5f1a5ab83f5f706f2472701a7f32fbc1dda42eeb (diff)
feat(comment): add `Twikoo` support (#286)
* Create twikoo.html * Upgrade to Twikoo 1.4.3 and add `lang` param * Add twikoo section in config.yaml Co-authored-by: Jimmy Cai <github@jimmycai.com>
-rw-r--r--exampleSite/config.yaml8
-rw-r--r--layouts/partials/comments/provider/twikoo.html42
2 files changed, 49 insertions, 1 deletions
diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml
index ac30c01..4046887 100644
--- a/exampleSite/config.yaml
+++ b/exampleSite/config.yaml
@@ -44,7 +44,7 @@ params:
article:
math: false
toc: true
- readingTime: true
+ readingTime: true
license:
enabled: true
default: Licensed under CC BY-NC-SA 4.0
@@ -87,6 +87,12 @@ params:
locale:
admin: Admin
+ twikoo:
+ envId:
+ region:
+ path:
+ lang:
+
widgets:
enabled:
- search
diff --git a/layouts/partials/comments/provider/twikoo.html b/layouts/partials/comments/provider/twikoo.html
new file mode 100644
index 0000000..00016b4
--- /dev/null
+++ b/layouts/partials/comments/provider/twikoo.html
@@ -0,0 +1,42 @@
+<script src="//cdn.jsdelivr.net/npm/twikoo@1.4.3/dist/twikoo.all.min.js"></script>
+<div id="tcomment"></div>
+<style>
+ .twikoo {
+ background-color: var(--card-background);
+ border-radius: var(--card-border-radius);
+ box-shadow: var(--shadow-l1);
+ padding: var(--card-padding);
+ }
+ .twikoo .el-input-group__prepend,
+ .twikoo .tk-action-icon,
+ .twikoo .tk-time,
+ .twikoo .tk-comments-count,
+ .twikoo .el-button {
+ color: var(--body-text-color);
+ }
+ .twikoo .el-input__inner,
+ .twikoo .el-textarea__inner,
+ .twikoo .tk-preview-container,
+ .twikoo .tk-content,
+ .twikoo .tk-nick {
+ color: var(--card-text-color-main);
+ }
+</style>
+
+{{- with .Site.Params.comments.twikoo -}}
+<script>
+ twikoo.init({
+ envId: '{{- .envId -}}',
+ el: '#tcomment',
+ {{- with .region -}}
+ region: '{{- . -}}',
+ {{- end -}}
+ {{- with .path -}}
+ path: '{{- . -}}',
+ {{- end -}}
+ {{- with .lang -}}
+ lang: '{{- . -}}',
+ {{- end -}}
+ })
+</script>
+{{- end -}}