Skip to content
This repository has been archived by the owner on Feb 2, 2024. It is now read-only.

Commit

Permalink
Giscus support + dev placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
soup-bowl committed Jan 8, 2024
1 parent 1ba555c commit 17887e9
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 30 deletions.
63 changes: 33 additions & 30 deletions _includes/disqus_comments.html
Original file line number Diff line number Diff line change
@@ -1,33 +1,36 @@
{%- if page.comments != false and jekyll.environment == "production" -%}
{%- if page.comments != false -%}

<hr>

<div id="load_disqus" class="aligncentre">
<button class="button" onclick="load_comments()">Load Discussion (Disqus)</button>
{%- if site.disqus.show_policy == true -%}
<p>By clicking on this button you are agreeing to the <a href="https://help.disqus.com/en/articles/1717103-disqus-privacy-policy">Disqus privacy policy</a>.</p>
{%- endif -%}
</div>

<div id="disqus_thread"></div>

<script>
var disqus_config = function () {
this.page.url = '{{ page.url | absolute_url }}';
this.page.identifier = '{{ page.url | absolute_url }}';
};

function load_comments() {
document.getElementById("load_disqus").remove();

(function() {
var d = document, s = d.createElement('script');

s.src = 'https://{{ site.disqus.shortname }}.disqus.com/embed.js';

s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
}
</script>
{%- if jekyll.environment == "production" -%}
<div id="load_disqus" class="aligncentre">
<button class="button" onclick="load_comments()">Load Discussion (Disqus)</button>
{%- if site.disqus.show_policy == true -%}
<p>By clicking on this button you are agreeing to the <a href="https://help.disqus.com/en/articles/1717103-disqus-privacy-policy">Disqus privacy policy</a>.</p>
{%- endif -%}
</div>

<div id="disqus_thread"></div>

<script>
var disqus_config = function () {
this.page.url = '{{ page.url | absolute_url }}';
this.page.identifier = '{{ page.url | absolute_url }}';
};

function load_comments() {
document.getElementById("load_disqus").remove();

(function() {
var d = document, s = d.createElement('script');

s.src = 'https://{{ site.disqus.shortname }}.disqus.com/embed.js';

s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
}
</script>
{% else %}
<p style="text-align: center;">Discus comment box will appear here.</p>
{%- endif -%}
{%- endif -%}
25 changes: 25 additions & 0 deletions _includes/giscus_comments.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{%- if page.comments != false -%}
<hr>
<div class="giscus-box">
{%- if jekyll.environment == "production" -%}
<script src="https://giscus.app/client.js"
data-repo="soup-bowl/soup-bowl.github.io"
data-repo-id="MDEwOlJlcG9zaXRvcnk2MTIwOTcxMQ=="
data-category="General"
data-category-id="DIC_kwDOA6X8b84CcSWa"
data-mapping="title"
data-strict="0"
data-reactions-enabled="1"
data-emit-metadata="0"
data-input-position="top"
data-theme="transparent_dark"
data-lang="en"
data-loading="lazy"
crossorigin="anonymous"
async>
</script>
{% else %}
<p style="text-align: center;">giscus comment box will appear here.</p>
{%- endif -%}
</div>
{%- endif -%}
4 changes: 4 additions & 0 deletions _sass/minima.scss
Original file line number Diff line number Diff line change
Expand Up @@ -326,3 +326,7 @@ pre, code,
font-family: monospace;
}
}

.giscus-box {
padding: 25px 0 25px 0;
}

0 comments on commit 17887e9

Please sign in to comment.