aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkmdr2026-01-21 18:04:10 +0800
committerGitHub2026-01-21 02:04:10 -0800
commitd52609f456f233ec0845c8a57a1e27583f0813ad (patch)
tree7371acbeeb4f81a504e10feb2154df9c9eee580e
parent8decc5d2fafc1a2212959df2688da6ecb562502e (diff)
downloadabridge-2.5.1.tar.gz
abridge-2.5.1.tar.bz2
abridge-2.5.1.zip
feat: add remark42 support (#233)2.5.1
-rw-r--r--config.toml5
-rw-r--r--templates/page.html14
2 files changed, 18 insertions, 1 deletions
diff --git a/config.toml b/config.toml
index 86218d7..ea831a1 100644
--- a/config.toml
+++ b/config.toml
@@ -283,11 +283,16 @@ favicon16 = "favicon-16x16.png" # favicon-16x16.png
###############################################################################
### Commenting System for visitors to leave comments on pages.
### hyvor talk
+### remark42
###############################################################################
+#comment_system = "hyvor" # valid values are: "hyvor", "remark42"
+
#comments.hyvor = "9366" # hyvor website id, comment out to disable.
#comments.hyvorcolor = "os" # set the color property for hyvor
+#comments.remark42 = "https://comments.example.com" # remark42 server url, comment out to disable.
+#comments.remark42_site_id = "remark" # remark42 site id
###############################################################################
### Icons
diff --git a/templates/page.html b/templates/page.html
index 18a5153..10ea571 100644
--- a/templates/page.html
+++ b/templates/page.html
@@ -31,8 +31,16 @@
{%- endblock seo %}
{%- block comments_init %}
- {%- if config.extra.comments.hyvor %}
+ {%- if not config.extra.comment_system or config.extra.comment_system == "hyvor" and config.extra.comments.hyvor %}
<script defer src="https://talk.hyvor.com/embed/embed.js" type="module"></script>
+ {%- elif config.extra.comment_system == "remark42" and config.extra.comments.remark42 %}
+ <script>
+ var remark_config = {
+ host: "{{ config.extra.comments.remark42 | safe }}",
+ site_id: "{{ config.extra.comments.remark42_site_id }}",
+ }
+ </script>
+ <script>!function(e,n){for(var o=0;o<e.length;o++){var r=n.createElement("script"),c=".js",d=n.head||n.body;"noModule"in r?(r.type="module",c=".mjs"):r.async=!0,r.defer=!0,r.src=remark_config.host+"/web/"+e[o]+c,d.appendChild(r)}}(remark_config.components||["embed"],document);</script>
{%- endif %}
{%- endblock comments_init %}
@@ -90,9 +98,13 @@
{%- endblock page_footer %}
{%- block comments_body %}
+ {%- if not config.extra.comment_system or config.extra.comment_system == "hyvor" %}
{%- if config.extra.comments.hyvor %}
<hyvor-talk-comments website-id={{ config.extra.comments.hyvor }} page-id={{ page.slug }}{%- if config.extra.comments.hyvorcolor %} colors="{{ config.extra.comments.hyvorcolor }}"{%- endif %}></hyvor-talk-comments>
{%- endif %}
+ {%- elif config.extra.comment_system == "remark42" and config.extra.comments.remark42 %}
+ <div id="remark42"></div>
+ {%- endif %}
{%- endblock comments_body %}
</article>
{%- block toc %}