Config Giscus in Minimal Mistakes theme
Minimal Mistakes has some decent instructions on how to config Giscus.
Just one thing to pay attention to: giscus.app will output a <script>
tag containing all the configurations you choose. You can either:
- hardcode the
<script>
tag into your post’s html (e.g._layouts/single.html
), or - thanks to Minimal Mistakes, put those configurations inside
_config.yml
If you choose the 2nd method, note that you have to translate the attributes in the <script>
tag to YAML key/value pairs. Such translation can be made with the help from minimal-mistakes/_includes/comments-providers/giscus.html.
E.g. if you have the tag from giscus.app as:
<script src="https://giscus.app/client.js"
data-mapping="pathname"
......
data-theme="light"
async>
</script>
then you can translate it into _config.yml
as:
comments:
provider: giscus
giscus:
discussion_term: "pathname"
......
theme: "light"
because minimal-mistakes/_includes/comments-providers/giscus.html has done the following work for you:
script.setAttribute('data-mapping', 'pathname');
......
script.setAttribute('data-theme', 'light');
Comments