pages/_includes/giscus.liquid
Abhilesh Dhawanjewar 47b982bd0d
Add sidenote examples, related posts and giscus to distill posts (#3103)
This PR adds a few stylistic improvements to the distill-style blog
posts:

- Update distill blog post example to showcase sidenotes as an
alternative to styles in PR #3077
- Showcase equations in sidenotes (closes #1242)
- Add `overrides.js` to match footnotes and citation styles with global
theme styling
- Add "related posts" sections if enabled to distill style posts
- Add "giscus" section if enabled to distill style posts



https://github.com/user-attachments/assets/b19a9cd9-779d-4d89-a4fb-eb14fb384480
2025-07-16 15:07:42 -03:00

42 lines
1.7 KiB
Plaintext

<div
id="giscus_thread"
{% if page.layout == 'post' %}
style="max-width: {{ site.max_width }}; margin: 0 auto;"
{% endif %}
>
{% if page.layout == 'post' %}
<br>
{% endif %}
{% if site.giscus.repo %}
<script>
let giscusTheme = determineComputedTheme();
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>
{% else %}
{% capture giscus_warning %} > ##### giscus comments misconfigured > Please follow instructions at
[http://giscus.app](http://giscus.app) and update your giscus configuration. {: .block-danger } {% endcapture %}
{{ giscus_warning | markdownify }}
{% endif %}
</div>