<div id="__comments_script"></div>
<script>
  var comments = document.createElement('script');
  var commentsTheme = document.body.dataset.mdColorScheme === 'slate' ? 'dark' : 'light';

  Object.entries({
    async: true,
    src: "https://giscus.app/client.js",
    crossOrigin: "anonymous",
    "data-repo": "OI-wiki/gitment",
    "data-repo-id": "MDEwOlJlcG9zaXRvcnkxNDQzODg5NjU=",
    "data-category": "{% if config.theme.language == 'zh' %}评论{% else %}Comments{% endif %}",
    "data-category-id": "{% if config.theme.language == 'zh' %}DIC_kwDOCJszZc4CS54y{% else %}DIC_kwDOCJszZc4CS53G{% endif %}",
    "data-mapping": "specific",
    "data-term": "{{ pageID }}",
    "data-strict": "1",
    "data-reactions-enabled": "1",
    "data-emit-metadata": "0",
    "data-input-position": "top",
    "data-theme": commentsTheme,
    "data-lang": "{% if config.theme.language == 'zh' %}zh-CN{% else %}en-US{% endif %}",
    "data-loading": "lazy",
  }).forEach(e => comments.setAttribute(e[0], e[1]));

  document.getElementById('__comments_script').replaceWith(comments);
</script>
