~xdavidwu/xdavidwu.link

387322359f1ff1d06f5fdd54b929514e9dcb268c — Michael Rose 5 years ago 9e657b3
Add support for utterances (#1966)

* Add support for utterances
* Add utterances config documentation
* Update CHANGELOG and history

Close #1909 
M CHANGELOG.md => CHANGELOG.md +1 -0
@@ 2,6 2,7 @@

### Enhancements

- Add support for [utterances](https://utteranc.es/) comments. [#1909](https://github.com/mmistakes/minimal-mistakes/issues/1909)
- Use privacy aware embed options for YouTube and Vimeo in [responsive video helper](https://mmistakes.github.io/minimal-mistakes/docs/helpers/#responsive-video-embed). [#1964](https://github.com/mmistakes/minimal-mistakes/pull/1964)
- Add `rel="nofollow noopener noreferrer"` to author profile links. [#1924](https://github.com/mmistakes/minimal-mistakes/pull/1924)
- Improve color contrast of primary buttons and links.

M _config.yml => _config.yml +3 -1
@@ 27,7 27,7 @@ teaser                   : # path of fallback teaser image, e.g. "/assets/images
# breadcrumbs            : false # true, false (default)
words_per_minute         : 200
comments:
  provider               : # false (default), "disqus", "discourse", "facebook", "google-plus", "staticman", "staticman_v2" "custom"
  provider               : # false (default), "disqus", "discourse", "facebook", "google-plus", "staticman", "staticman_v2", "utterances", "custom"
  disqus:
    shortname            : # https://help.disqus.com/customer/portal/articles/466208-what-s-a-shortname-
  discourse:


@@ 37,6 37,8 @@ comments:
    appid                :
    num_posts            : # 5 (default)
    colorscheme          : # "light" (default), "dark"
  utterances:
    theme                : # "github-light" (default), "github-dark"
staticman:
  allowedFields          : # ['name', 'email', 'url', 'message']
  branch                 : # "master"

M _includes/comments-providers/scripts.html => _includes/comments-providers/scripts.html +2 -0
@@ 12,6 12,8 @@
    {% include /comments-providers/staticman.html %}
  {% when "staticman_v2" %}
    {% include /comments-providers/staticman_v2.html %}
  {% when "utterances" %}
    {% include /comments-providers/utterances.html %}
  {% when "custom" %}
    {% include /comments-providers/custom.html %}
{% endcase %}

A _includes/comments-providers/utterances.html => _includes/comments-providers/utterances.html +20 -0
@@ 0,0 1,20 @@
<script>
  'use strict';

  (function() {
    var commentContainer = document.querySelector('#utterances-comments');

    if (!commentContainer) {
      return;
    }

    var script = document.createElement('script');
    script.setAttribute('src', 'https://utteranc.es/client.js');
    script.setAttribute('repo', '{{ site.repository }}');
    script.setAttribute('issue-term', 'pathname');
    script.setAttribute('theme', '{{ site.comments.utterances.theme | default: "github-light" }}');
    script.setAttribute('crossorigin', 'anonymous');

    commentContainer.appendChild(script);
  })();
</script>
\ No newline at end of file

M _includes/comments.html => _includes/comments.html +3 -0
@@ 165,6 165,9 @@
          <!-- End new comment form -->
        {% endif %}
      </section>
    {% when "utterances" %}
      <h4 class="page__comments-title">{{ comments_label }}</h4>
      <section id="utterances-comments"></section>
    {% when "custom" %}
      <section id="custom-comments"></section>
  {% endcase %}