<% if (theme.utterances.repo && theme.utterances.issue_term) { %>
  <script type="text/javascript">
    Fluid.utils.loadComments('#comments', function() {
      var light = '<%= theme.utterances.theme || 'github-light' %>';
      var dark = '<%= theme.utterances.theme_dark || 'github-dark' %>';
      var schema = document.documentElement.getAttribute('data-user-color-scheme');
      if (schema === 'dark') {
        schema = dark;
      } else {
        schema = light;
      }
      window.UtterancesThemeLight = light;
      window.UtterancesThemeDark = dark;
      var s = document.createElement('script');
      s.setAttribute('src', 'https://utteranc.es/client.js');
      s.setAttribute('repo', '<%= theme.utterances.repo %>');
      s.setAttribute('issue-term', '<%= theme.utterances.issue_term %>');
      <% if (theme.utterances.label) { %>
      s.setAttribute('label', '<%= theme.utterances.label %>');
      <% } %>
      s.setAttribute('theme', schema);
      s.setAttribute('crossorigin', 'anonymous');
      document.getElementById('comments').appendChild(s);
    })
  </script>
  <noscript>Please enable JavaScript to view the comments</noscript>
<% } %>
