add utterances comments support (#596)

This commit is contained in:
colynn.liu 2020-04-02 05:25:11 +08:00 committed by GitHub
parent a04be276e3
commit 890f66966e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 29 additions and 0 deletions

View File

@ -114,12 +114,17 @@ To use Disqus, simply sign up to [Disqus](https://disqus.com/) and add your Disq
To use Facebook comments, create a Facebook app using [Facebook developers](https://developers.facebook.com/docs/apps/register), and add the Facebook App ID to the `fb_comment_id` parameter in `_config.yml`. To use Facebook comments, create a Facebook app using [Facebook developers](https://developers.facebook.com/docs/apps/register), and add the Facebook App ID to the `fb_comment_id` parameter in `_config.yml`.
#### Utterances comments
To use [Utterances comments](https://utteranc.es/), follow these steps: (1) Enable Issues in your GitHub repository, (2) Install the Utterances app in your repository (go to https://github.com/apps/utterances), (3) Fill in the `repository` parameter in the utterances section of the `_config.yml` file.
#### Staticman comments #### Staticman comments
To use Staticman, you first need to invite `staticmanlab` as a collaborator to your repository (by going to your repository **Settings** page, navigate to the **Collaborators** tab, and add the username `staticmanlab`), and then accept the invitation by going to `https://staticman3.herokuapp.com/v3/connect/github/<username>/<repo-name>`. Lastly, fill in the `staticman` parameters in the Staticman section of `_config.yml`. You may also choose a different Staticman instance other than `staticmanlab`. To use Staticman, you first need to invite `staticmanlab` as a collaborator to your repository (by going to your repository **Settings** page, navigate to the **Collaborators** tab, and add the username `staticmanlab`), and then accept the invitation by going to `https://staticman3.herokuapp.com/v3/connect/github/<username>/<repo-name>`. Lastly, fill in the `staticman` parameters in the Staticman section of `_config.yml`. You may also choose a different Staticman instance other than `staticmanlab`.
Optional: You may want to configure a webhook to prevent old inactive branches (representing approved comments) from stacking up. You can refer to [Staticman's documentation](https://staticman.net/docs/webhooks) for details. Make sure to input the **Payload URL** according to your chosen `endpoint`. For example, the default `endpoint` is `https://staticman3.herokuapp.com/v3/entry/github/`, so the corresponding **Payload URL** should be `https://staticman3.herokuapp.com/v1/webhook`. Optional: You may want to configure a webhook to prevent old inactive branches (representing approved comments) from stacking up. You can refer to [Staticman's documentation](https://staticman.net/docs/webhooks) for details. Make sure to input the **Payload URL** according to your chosen `endpoint`. For example, the default `endpoint` is `https://staticman3.herokuapp.com/v3/entry/github/`, so the corresponding **Payload URL** should be `https://staticman3.herokuapp.com/v1/webhook`.
### Adding Google Analytics to track page views ### Adding Google Analytics to track page views
Beautiful Jekyll lets you easily add Google Analytics to all your pages. This will let you track all sorts of information about visits to your website, such as how many times each page is viewed and where (geographically) your users come from. To add Google Analytics, simply sign up to [Google Analytics](https://www.google.com/analytics/) to obtain your Google Tracking ID, and add this tracking ID to the `google_analytics` parameter in `_config.yml`. Beautiful Jekyll lets you easily add Google Analytics to all your pages. This will let you track all sorts of information about visits to your website, such as how many times each page is viewed and where (geographically) your users come from. To add Google Analytics, simply sign up to [Google Analytics](https://www.google.com/analytics/) to obtain your Google Tracking ID, and add this tracking ID to the `google_analytics` parameter in `_config.yml`.

View File

@ -134,6 +134,15 @@ staticman:
siteKey : # Use your own site key, you need to apply for one on Google siteKey : # Use your own site key, you need to apply for one on Google
secret : # ENCRYPT your password by going to https://staticman3.herokuapp.com/v3/encrypt/<your-site-secret> secret : # ENCRYPT your password by going to https://staticman3.herokuapp.com/v3/encrypt/<your-site-secret>
# To use Utterances comments: (1) fill in repository (make sure the repository is public), (2) Enable Issues in your repository, (3) Install the Utterances app in your repository https://github.com/apps/utterances
# See more details about the parameters below at https://utteranc.es/
utterances:
repository: # GitHub username/repository eg. "daattali/beautiful-jekyll"
issue-term: title # Mapping between blog posts and GitHub issues
theme: github-light # Utterances theme
label: blog-comments # Label that will be assigned to GitHub Issues created by Utterances
# --- Misc --- # # --- Misc --- #
# Facebook App ID # Facebook App ID

View File

@ -0,0 +1,13 @@
{% if site.utterances.repo and site.utterances.issue-term %}
<script src="https://utteranc.es/client.js"
repository="{{site.utterances.repo }}"
issue-term="{{ site.utterances.issue-term }}"
theme="{{ site.utterances.theme}}"
label="{{ site.utterances.label}}"
crossorigin="anonymous"
async>
</script>
{% endif %}

View File

@ -16,6 +16,7 @@ layout: base
<div class="staticman-comments"> <div class="staticman-comments">
{% include staticman-comments.html %} {% include staticman-comments.html %}
</div> </div>
{% include utterances-comment.html %}
{% endif %} {% endif %}
</div> </div>
</div> </div>

View File

@ -73,6 +73,7 @@ layout: base
<div class="staticman-comments"> <div class="staticman-comments">
{% include staticman-comments.html %} {% include staticman-comments.html %}
</div> </div>
{% include utterances-comment.html %}
{% endif %} {% endif %}
</div> </div>
</div> </div>