added new comment system
All checks were successful
ci / deploy (push) Successful in 34s

This commit is contained in:
Stephan Hadan 2025-01-08 19:40:17 +01:00
parent 6aa285569e
commit b5ee87e8c8
4 changed files with 131 additions and 59 deletions

View file

@ -1,54 +1,19 @@
{% if page.meta.comments %}
<h2 id="__comments">{{ lang.t("meta.comments") }}</h2>
<!-- Insert generated snippet here -->
<script src="https://giscus.app/client.js"
data-repo="stiebke/stiebke.github.io"
data-repo-id="R_kgDONXxN1Q"
data-category="Show and tell"
data-category-id="DIC_kwDONXxN1c4Ck44X"
data-mapping="pathname"
data-strict="0"
data-reactions-enabled="1"
data-emit-metadata="0"
data-input-position="bottom"
data-theme="light"
data-lang="de"
crossorigin="anonymous"
async>
</script>
<!-- Synchronize Giscus theme with palette -->
<script>
var giscus = document.querySelector("script[src*=giscus]")
// Set palette on initial load
var palette = __md_get("__palette")
if (palette && typeof palette.color === "object") {
var theme = palette.color.scheme === "slate"
? "transparent_dark"
: "light"
// Instruct Giscus to set theme
giscus.setAttribute("data-theme", theme)
}
// Register event handlers after documented loaded
document.addEventListener("DOMContentLoaded", function() {
var ref = document.querySelector("[data-md-component=palette]")
ref.addEventListener("change", function() {
var palette = __md_get("__palette")
if (palette && typeof palette.color === "object") {
var theme = palette.color.scheme === "slate"
? "transparent_dark"
: "light"
// Instruct Giscus to change theme
var frame = document.querySelector(".giscus-frame")
frame.contentWindow.postMessage(
{ giscus: { setConfig: { theme } } },
"https://giscus.app"
)
}
})
})
{% set isso = config.extra.isso %}
{% if page and page.meta and page.meta.isso is string %}
{% set isso = page.meta.isso %}
{% endif %}
{% if not page.is_homepage %}
{# Comment system (Isso) #}
<div id="__comments">
<script
data-isso="{{ config.extra.isso.custom_url }}/"
data-isso-require-author="true"
data-isso-require-email="true"
data-isso-reply-to-self="false"
data-isso-vote="true"
src="{{ config.extra.isso.custom_url }}/js/embed.min.js">
</script>
{% endif %}
<hr><section id="isso-thread"><h2>Comments</h2></section>
<noscript>Please enable JavaScript to view the comments.</noscript>
</div>
{% endif %}