Initial Cactus Comments implementation

This commit is contained in:
Jez Cope 2021-05-11 17:36:17 +01:00
parent c3be616e1e
commit 8b15b6b220
6 changed files with 22 additions and 1 deletions

7
assets/js/cactus.js.tmpl Normal file
View File

@ -0,0 +1,7 @@
initComments({
node: document.getElementById("cactus-comments"), // HTML element to make comments section in
defaultHomeserverUrl: "https://matrix.cactus.chat:8448", // full url of the Matrix server to use as guest
serverName: "cactus.chat", // server name of the Matrix server w/ Cactus Appservice
siteName: "{{ .Site.Params.comments.cactus }}", // the name that you registered with the cactus appservice
commentSectionId: "{{ .Page.Permalink }}" // unique ID for this comments section.
})

View File

@ -14,6 +14,7 @@
{{ with .Site.Params.author }}<meta name="author" content="{{ . }}">{{ end }}
{{ $style := resources.Get "style/main.sass" | resources.ToCSS }}
<link rel="stylesheet" href="{{ $style.RelPermalink }}">
{{ if .Site.Params.comments.cactus }}<link rel="stylesheet" href="https://latest.cactus.chat/style.css" type="text/css">{{ end }}
{{ with .OutputFormats.Get "RSS" -}}
{{ printf `<link rel="%s" type="%s" href="%s" title="%s">` .Rel .MediaType.Type .RelPermalink $.Site.Title | safeHTML }}
{{- end }}

View File

@ -2,6 +2,7 @@
<div class="columns">
<div class="column is-8 is-offset-2">
{{ partial "comments/webmention" . }}
{{ partial "comments/cactus" . }}
{{ with .Site.DisqusShortname }}
<div>
{{ template "_internal/disqus.html" . }}

View File

@ -0,0 +1,7 @@
{{ if .Site.Params.comments.cactus }}
<hr />
<div class="content">
<h2>Comments</h2>
</div>
<div id="cactus-comments"></div>
{{ end }}

View File

@ -1,7 +1,7 @@
{{ if .Site.Params.comments.webmention }}
<hr />
<div class="content">
<h2>Comments</h2>
<h2>Webmentions</h2>
<form method="get" action="https://quill.p3k.io/" target="_blank"><input type="hidden" name="dontask" value="1">
<input type="hidden" name="me" value="https://commentpara.de/">
<input type="hidden" name="reply" value="{{ .Permalink }}">

View File

@ -6,3 +6,8 @@
data-page-url="{{ .Permalink }}"
async></script>
{{ end }}
{{ if .Site.Params.comments.cactus }}
<script type="text/javascript" src="https://latest.cactus.chat/cactus.js"></script>
{{ $cactus_js := resources.Get "js/cactus.js.tmpl" | resources.ExecuteAsTemplate "js/cactus.js" . }}
<script src="{{ $cactus_js.RelPermalink }}" async></script>
{{ end }}