Skip to content

Commit

Permalink
feat: add back giscus and plausible
Browse files Browse the repository at this point in the history
I should have done that a while back
  • Loading branch information
Guekka committed Jun 28, 2024
1 parent 0b27aa7 commit ed18608
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 5 deletions.
6 changes: 2 additions & 4 deletions content/_index.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
+++
paginate_by = 3
sort_by = "date"
template = "index.html"

[extra]
sec = ""
template = "index_analytics.html"
page_template = "page_analytics.html"
+++
2 changes: 1 addition & 1 deletion content/posts/_index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
+++
title = "posts"
paginate_by = 10
template = "index.html"
template = "index_analytics.html"
+++
5 changes: 5 additions & 0 deletions templates/index_analytics.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{%- extends "index.html" %}
{% block content %}
{{ super() }}
<script defer data-domain="guekka.github.io" src="https://plausible.bizel.fr/js/script.js"></script>
{% endblock content %}
29 changes: 29 additions & 0 deletions templates/page_analytics.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{%- extends "page.html" %}
{% block comments_init %}
<script defer data-domain="guekka.github.io" src="https://plausible.bizel.fr/js/script.js"></script>
{% endblock comments_init %}

{% block comments_body %}

<noscript>Please enable JavaScript for accessing the comments</noscript>

<script src="https://giscus.app/client.js" data-repo="guekka/guekka.github.io" data-repo-id="R_kgDOI_vZbw"
data-category="General" data-category-id="DIC_kwDOI_vZb84CUeNw" data-mapping="og:title" data-strict="0"
data-reactions-enabled="1" data-emit-metadata="0" data-input-position="bottom" data-theme="preferred_color_scheme"
data-lang="en" data-loading="lazy" crossorigin="anonymous" async>
</script>

<script>
function update() {
const islight = document.documentElement.classList.contains("light");
const theme = islight ? 'light' : 'dark_dimmed';

const message = { setConfig: { theme: theme } };
const iframe = document.querySelector('.giscus-frame');
iframe.contentWindow.postMessage({ giscus: message }, 'https://giscus.app');
}
document.getElementById('mode').addEventListener('click', () => setTimeout(update, 100)); // hack since callback order is undefined
window.addEventListener('load', update);
</script>

{% endblock comments_body %}

0 comments on commit ed18608

Please sign in to comment.