Skip to content

Commit 4867726

Browse files
authored
Add support for utterances (mmistakes#1966)
* Add support for utterances * Add utterances config documentation * Update CHANGELOG and history Close mmistakes#1909
1 parent 24ec8cd commit 4867726

File tree

11 files changed

+72
-18
lines changed

11 files changed

+72
-18
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
### Enhancements
44

5+
- Add support for [utterances](https://utteranc.es/) comments. [#1909](https://github.com/mmistakes/minimal-mistakes/issues/1909)
56
- 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)
67
- Add `rel="nofollow noopener noreferrer"` to author profile links. [#1924](https://github.com/mmistakes/minimal-mistakes/pull/1924)
78
- Improve color contrast of primary buttons and links.

_config.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ teaser : # path of fallback teaser image, e.g. "/assets/images
2727
# breadcrumbs : false # true, false (default)
2828
words_per_minute : 200
2929
comments:
30-
provider : # false (default), "disqus", "discourse", "facebook", "google-plus", "staticman", "staticman_v2" "custom"
30+
provider : # false (default), "disqus", "discourse", "facebook", "google-plus", "staticman", "staticman_v2", "utterances", "custom"
3131
disqus:
3232
shortname : # https://help.disqus.com/customer/portal/articles/466208-what-s-a-shortname-
3333
discourse:
@@ -37,6 +37,8 @@ comments:
3737
appid :
3838
num_posts : # 5 (default)
3939
colorscheme : # "light" (default), "dark"
40+
utterances:
41+
theme : # "github-light" (default), "github-dark"
4042
staticman:
4143
allowedFields : # ['name', 'email', 'url', 'message']
4244
branch : # "master"

_includes/comments-providers/scripts.html

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
{% include /comments-providers/staticman.html %}
1313
{% when "staticman_v2" %}
1414
{% include /comments-providers/staticman_v2.html %}
15+
{% when "utterances" %}
16+
{% include /comments-providers/utterances.html %}
1517
{% when "custom" %}
1618
{% include /comments-providers/custom.html %}
1719
{% endcase %}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<script>
2+
'use strict';
3+
4+
(function() {
5+
var commentContainer = document.querySelector('#utterances-comments');
6+
7+
if (!commentContainer) {
8+
return;
9+
}
10+
11+
var script = document.createElement('script');
12+
script.setAttribute('src', 'https://utteranc.es/client.js');
13+
script.setAttribute('repo', '{{ site.repository }}');
14+
script.setAttribute('issue-term', 'pathname');
15+
script.setAttribute('theme', '{{ site.comments.utterances.theme | default: "github-light" }}');
16+
script.setAttribute('crossorigin', 'anonymous');
17+
18+
commentContainer.appendChild(script);
19+
})();
20+
</script>

_includes/comments.html

+3
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,9 @@ <h4 class="page__comments-title">{{ site.data.ui-text[site.locale].comments_labe
165165
<!-- End new comment form -->
166166
{% endif %}
167167
</section>
168+
{% when "utterances" %}
169+
<h4 class="page__comments-title">{{ comments_label }}</h4>
170+
<section id="utterances-comments"></section>
168171
{% when "custom" %}
169172
<section id="custom-comments"></section>
170173
{% endcase %}

docs/_config.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ teaser : # path of fallback teaser image, e.g. "/assets/images
2222
# breadcrumbs : false # true, false (default)
2323
words_per_minute : 200
2424
comments:
25-
provider : "staticman_v2" # false (default), "disqus", "discourse", "facebook", "google-plus", "staticman_v2", "staticman" "custom"
25+
provider : "staticman_v2" # false (default), "disqus", "discourse", "facebook", "google-plus", "staticman_v2", "staticman", "utterances", "custom"
2626
disqus:
2727
shortname :
2828
discourse:
@@ -32,6 +32,8 @@ comments:
3232
appid :
3333
num_posts : # 5 (default)
3434
colorscheme : # "light" (default), "dark"
35+
utterances:
36+
theme : # "github-light" (default), "github-dark"
3537
staticman:
3638
allowedFields : # ['name', 'email', 'url', 'message']
3739
branch : "master"

docs/_docs/02-structure.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ minimal-mistakes
1717
| └── ui-text.yml # text used throughout the theme's UI
1818
├── _includes
1919
| ├── analytics-providers # snippets for analytics (Google and custom)
20-
| ├── comments-providers # snippets for comments (Disqus, Facebook, Google+, and custom)
20+
| ├── comments-providers # snippets for comments
2121
| ├── footer # custom snippets to add to site footer
2222
| ├── head # custom snippets to add to site head
2323
| ├── feature_row # feature row helper

docs/_docs/05-configuration.md

+32-11
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: "Configuration"
33
permalink: /docs/configuration/
44
excerpt: "Settings for configuring and customizing the theme."
5-
last_modified_at: 2018-11-19T15:35:29-05:00
5+
last_modified_at: 2018-11-21T14:46:33-05:00
66
toc: true
77
---
88

@@ -274,7 +274,7 @@ To disable reading time for a post, add `read_time: false` its YAML Front Matter
274274

275275
### Comments
276276

277-
[**Disqus**](https://disqus.com/), [**Discourse**](https://www.discourse.org/), [**Facebook**](https://developers.facebook.com/docs/plugins/comments), **Google+**, and static-based commenting via [**Staticman**](https://staticman.net/) are built into the theme. First set the comment provider you'd like to use:
277+
[**Disqus**](https://disqus.com/), [**Discourse**](https://www.discourse.org/), [**Facebook**](https://developers.facebook.com/docs/plugins/comments), **Google+**, [**utterances**](https://utteranc.es/), and static-based commenting via [**Staticman**](https://staticman.net/) are built into the theme. First set the comment provider you'd like to use:
278278

279279
| Name | Comment Provider |
280280
| ---------------- | ------------------------- |
@@ -284,6 +284,7 @@ To disable reading time for a post, add `read_time: false` its YAML Front Matter
284284
| **google-plus** | Google+ Comments |
285285
| **staticman_v2** | Staticman v2 |
286286
| **staticman** | Staticman v1 (deprecated) |
287+
| **utterances** | utterances |
287288
| **custom** | Other |
288289

289290
Then add `comments: true` to each document you want comments visible on.
@@ -323,9 +324,9 @@ For guidance on how to set up Discourse for embedding comments from a topic on a
323324

324325
```yaml
325326
comments:
326-
provider : "discourse"
327+
provider: "discourse"
327328
discourse:
328-
server : # meta.discourse.org
329+
server: # meta.discourse.org
329330
```
330331

331332
**Note:** Do not include `http://` or `https://` when setting your Discourse `server`. The theme automatically prepends the URL `//`, following a scheme-less pattern.
@@ -337,11 +338,31 @@ To enable Facebook Comments choose how many comments you'd like visible per post
337338

338339
```yaml
339340
comments:
340-
provider : "facebook"
341+
provider: "facebook"
341342
facebook:
342-
appid : # optional
343-
num_posts : # 5 (default)
344-
colorscheme : # "light" (default), "dark"
343+
appid: # optional
344+
num_posts: # 5 (default)
345+
colorscheme: # "light" (default), "dark"
346+
```
347+
348+
#### utterances Comments
349+
350+
To use utterances you will need to [install the app](https://github.com/apps/utterances) to your GitHub repository by adding the following to `_config.yml`:
351+
352+
```yaml
353+
repository: # GitHub username/repo-name e.g. "mmistakes/minimal-mistakes"
354+
```
355+
356+
**Note:** Make sure the repo is public, otherwise your readers will not be able to view the issues/comments. The [issues feature](https://guides.github.com/features/issues/) also needs to be active on your repo.
357+
{: .notice--warning}
358+
359+
To enable utterances on the front end set `comments.provider` and the color theme of the widget.
360+
361+
```yaml
362+
comments:
363+
provider: "utterances"
364+
utterances:
365+
theme: "github-light" # "github-dark"
345366
```
346367

347368
#### Static-Based Comments via Staticman
@@ -361,11 +382,11 @@ Transform user comments into `_data` files that live inside of your GitHub repos
361382

362383
##### Configure Staticman
363384

364-
**Staticman v3**
385+
###### Staticman v3
365386

366387
Due to the support for GitLab, the URL scheme has been changed. Bewteen `v3` and `/entry`, one needs to input a Git service provider (either `github` or `gitlab`). Apart from that, the setup for GitHub remains the same.
367388

368-
**Staticman v2**
389+
###### Staticman v2
369390

370391
Default settings have been provided in [`staticman.yml`](https://github.com/mmistakes/minimal-mistakes/blob/master/staticman.yml) and are commented to guide you through setup. View the [full list of configurations](https://staticman.net/docs/configuration).
371392

@@ -406,7 +427,7 @@ comments:
406427
**Note:** Staticman is currently compatible with GitHub and GitLab based repositories. [Support for GitLab Pages](https://github.com/eduardoboucas/staticman/issues/22) is already available at [Staticman v3](https://github.com/eduardoboucas/staticman/pull/219).
407428
{: .notice--warning}
408429

409-
**Staticman v1 (deprecated)**
430+
###### Staticman v1 (deprecated)
410431

411432
Default settings have been provided in `_config.yml`. The important ones to set are `provider: "staticman"`, `branch`, and `path`. View the [full list of configurations](https://staticman.net/docs/configuration).
412433

docs/_docs/18-history.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ permalink: /docs/history/
44
excerpt: "Change log of enhancements and bug fixes made to the theme."
55
sidebar:
66
nav: docs
7-
last_modified_at: 2018-11-21T14:16:10-05:00
7+
last_modified_at: 2018-11-21T14:55:38-05:00
88
toc: true
99
---
1010

1111
## Unreleased
1212

1313
### Enhancements
1414

15+
- Add support for [utterances](https://utteranc.es/) comments. [#1909](https://github.com/mmistakes/minimal-mistakes/issues/1909)
1516
- 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)
1617
- Add `rel="nofollow noopener noreferrer"` to author profile links. [#1924](https://github.com/mmistakes/minimal-mistakes/pull/1924)
1718
- Improve color contrast of primary buttons and links.

docs/_pages/about.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ layouts_gallery:
1212
- url: /assets/images/mm-layout-archive.png
1313
image_path: /assets/images/mm-layout-archive.png
1414
alt: "archive layout example"
15-
last_modified_at: 2018-06-04T12:04:24-04:00
15+
last_modified_at: 2018-11-21T14:49:33-05:00
1616
toc: true
1717
---
1818

@@ -31,7 +31,7 @@ Minimal Mistakes is a flexible two-column Jekyll theme. Perfect for hosting your
3131
- Several responsive layout options (single, archive index, search, splash, and paginated home page).
3232
- Optimized for search engines with support for [Twitter Cards](https://dev.twitter.com/cards/overview) and [Open Graph](http://ogp.me/) data
3333
- Optional [header images](https://mmistakes.github.io/minimal-mistakes/docs/layouts/#headers), [custom sidebars](https://mmistakes.github.io/minimal-mistakes/docs/layouts/#sidebars), [table of contents](https://mmistakes.github.io/minimal-mistakes/docs/helpers/#table-of-contents), [galleries](https://mmistakes.github.io/minimal-mistakes/docs/helpers/#gallery), related posts, [breadcrumb links](https://mmistakes.github.io/minimal-mistakes/docs/configuration/#breadcrumb-navigation-beta), [navigation lists](https://mmistakes.github.io/minimal-mistakes/docs/helpers/#navigation-list), and more.
34-
- Commenting support (powered by [Disqus](https://disqus.com/), [Facebook](https://developers.facebook.com/docs/plugins/comments), Google+, [Discourse](https://www.discourse.org/), static-based via [Staticman v1 and v2](https://staticman.net/), and custom).
34+
- Commenting support (powered by [Disqus](https://disqus.com/), [Facebook](https://developers.facebook.com/docs/plugins/comments), Google+, [Discourse](https://www.discourse.org/), [utterances](https://utteranc.es/), static-based via [Staticman v1 and v2](https://staticman.net/), and custom).
3535
- [Google Analytics](https://www.google.com/analytics/) support.
3636
- UI localized text in English (default), Brazilian Portuguese (Português brasileiro), Chinese, Danish, Dutch, French (Français), German (Deutsch), Greek, Hungarian, Indonesian, Italian (Italiano), Japanese, Korean, Nepali (Nepalese), Polish, Punjabi (ਪੰਜਾਬੀ) Romanian, Russian, Slovak, Spanish (Español), Swedish, Turkish (Türkçe), and Vietnamese.
3737

test/_config.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ teaser : # path of fallback teaser image, e.g. "/assets/images
2121
# breadcrumbs : false # true, false (default)
2222
words_per_minute : 200
2323
comments:
24-
provider : # false (default), "disqus", "discourse", "facebook", "google-plus", "staticman", "custom"
24+
provider : # false (default), "disqus", "discourse", "facebook", "google-plus", "staticman", "utterances", "custom"
2525
disqus:
2626
shortname : # https://help.disqus.com/customer/portal/articles/466208-what-s-a-shortname-
2727
discourse:
@@ -31,6 +31,8 @@ comments:
3131
appid :
3232
num_posts : # 5 (default)
3333
colorscheme : # "light" (default), "dark"
34+
utterances:
35+
theme : # "github-light" (default), "github-dark"
3436
staticman:
3537
allowedFields : ['name', 'email', 'url', 'message']
3638
branch : # "master", "gh-pages"

0 commit comments

Comments
 (0)