Skip to content

Commit

Permalink
Merge pull request #4 from ahmedakef/support_giscus
Browse files Browse the repository at this point in the history
support giscus
  • Loading branch information
ahmedakef authored Dec 17, 2022
2 parents ab601f1 + 96366c2 commit 9f2f977
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 26 deletions.
5 changes: 1 addition & 4 deletions layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,5 @@
<h1>{{ .Title }}</h1>
<time datetime="{{ .Date }}" itemprop="datePublished">{{ .Date.Format "January 2, 2006" }}</time>
{{ .Content }}
<br>
<hr style="height:2px;border-width:0;color:gray;background-color:gray">
<h3>comments:</h3>
{{ partial "comments.html" . }}
{{ partial "comments/entry_point.html" . }}
{{ end }}
22 changes: 0 additions & 22 deletions layouts/partials/comments.html

This file was deleted.

12 changes: 12 additions & 0 deletions layouts/partials/comments/engine/cactus.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<script type="text/javascript" src="https://latest.cactus.chat/cactus.js"></script>
<link rel="stylesheet" href="https://latest.cactus.chat/style.css" type="text/css">
<div id="comment-section"></div>
<script>
initComments({
node: document.getElementById("comment-section"),
defaultHomeserverUrl: "https://matrix.cactus.chat:8448",
serverName: "cactus.chat",
siteName: "{{ .Site.Params.Comments.CactusSiteName }}",
commentSectionId: "{{ .RelPermalink }}"
})
</script>
15 changes: 15 additions & 0 deletions layouts/partials/comments/engine/giscus.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<script src="https://giscus.app/client.js"
data-repo="{{ .Site.Params.Comments.GitHubRepo }}"
data-repo-id="MDEwOlJlcG9zaXRvcnkxOTA2NDkwNzk="
data-category="Announcements"
data-category-id="DIC_kwDOC10S984CTH4M"
data-mapping="pathname"
data-strict="0"
data-reactions-enabled="1"
data-emit-metadata="0"
data-input-position="bottom"
data-theme="light"
data-lang="en"
crossorigin="anonymous"
async>
</script>
14 changes: 14 additions & 0 deletions layouts/partials/comments/entry_point.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{ if (isset .Site.Params.Comments "enabled") }}
{{ .Scratch.Set "enable_comments" .Site.Params.Comments.Enabled }}
{{ else }}
{{ .Scratch.Set "enable_comments" false }}
{{ end }}


{{ $enable_comments := .Scratch.Get "enable_comments" }}
{{ if $enable_comments }}
<br>
<hr style="height:2px;border-width:0;color:gray;background-color:gray">
<h4>comments:</h4>
{{ partial (printf "comments/engine/%s" .Site.Params.comments.engine) . }}
{{ end }}

0 comments on commit 9f2f977

Please sign in to comment.