Switch to using data-* attributes

This commit is contained in:
Jez Cope 2021-05-11 18:02:29 +01:00
parent 246ba8bf87
commit f49915e134
2 changed files with 8 additions and 11 deletions

View File

@ -1,7 +0,0 @@
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: "{{ .File.BaseFileName }}" // unique ID for this comments section.
})

View File

@ -1,13 +1,17 @@
<script type="text/javascript" src="/js/navbar.js"></script>
{{ $page_id := .File.BaseFileName }}
{{ if .Site.Params.comments.webmention }}
{{ $webmention_js := resources.Get "js/webmention.js" | minify }}
<script src="{{ $webmention_js.RelPermalink }}"
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>
{{ with .Site.Params.comments.cactus }}
<script type="text/javascript" src="https://latest.cactus.chat/cactus.js"
data-default-homeserver-url="https://matrix.cactus.chat:8448"
data-server-name="cactus.chat"
data-site-name="{{ . }}"
data-node="#cactus-comments"
data-comment-section-id="{{ $page_id }}"></script>
{{ end }}