Skip to content

Commit

Permalink
Add support for giscus comments (alshedivat#1028)
Browse files Browse the repository at this point in the history
  • Loading branch information
Demi-wlw authored Mar 11, 2023
1 parent 8bc69af commit 6887f2b
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions _includes/giscus.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<div id="giscus_thread" style="max-width: {{ site.max_width }}; margin: 0 auto;">
<script>
let giscusTheme = localStorage.getItem("theme");
let giscusAttributes = {
"src": "https://giscus.app/client.js",
"data-repo": "{{ site.giscus.repo }}",
"data-repo-id": "{{ site.giscus.repo_id }}",
"data-category": "{{ site.giscus.category }}",
"data-category-id": "{{ site.giscus.category_id }}",
"data-mapping": "{{ site.giscus.mapping }}",
"data-strict": "{{ site.giscus.strict }}",
"data-reactions-enabled": "{{ site.giscus.reactions_enabled }}",
"data-emit-metadata": "{{ site.giscus.emit_metadata }}",
"data-input-position": "{{ site.giscus.input_position }}",
"data-theme": giscusTheme,
"data-lang": "{{ site.giscus.lang }}",
"crossorigin": "anonymous",
"async": "",
};


let giscusScript = document.createElement("script");
Object.entries(giscusAttributes).forEach(([key, value]) => giscusScript.setAttribute(key, value));
document.getElementById("giscus_thread").appendChild(giscusScript);
</script>
<noscript>Please enable JavaScript to view the <a href="http://giscus.app/?ref_noscript">comments powered by giscus.</a></noscript>
</div>

0 comments on commit 6887f2b

Please sign in to comment.