Skip to content

Commit

Permalink
Allow custom Staticman endpoints (mmistakes#1845)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxime-michel authored and mmistakes committed Sep 21, 2018
1 parent 6d6d738 commit 4bd6efc
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ staticman:
type : # "date"
options:
format : # "iso8601" (default), "timestamp-seconds", "timestamp-milliseconds"
endpoint : # URL of your own deployment with trailing slash, will fallback to the public instance
reCaptcha:
siteKey :
secret :
Expand Down
4 changes: 2 additions & 2 deletions _includes/comments.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ <h4 class="page__comments-title">{{ site.data.ui-text[site.locale].comments_titl
<div class="page__comments-form">
<h4 class="page__comments-title">{{ site.data.ui-text[site.locale].comments_label | default: "Leave a Comment" }}</h4>
<p class="small">{{ site.data.ui-text[site.locale].comment_form_info | default: "Your email address will not be published. Required fields are marked" }} <span class="required">*</span></p>
<form id="new_comment" class="page__comments-form js-form form" method="post" action="https://api.staticman.net/v2/entry/{{ site.repository }}/{{ site.staticman.branch }}/comments">
<form id="new_comment" class="page__comments-form js-form form" method="post" action="{{ site.staticman.endpoint | default: 'https://api.staticman.net/v2/entry/' }}{{ site.repository }}/{{ site.staticman.branch }}/comments">
<div class="form__spinner">
<i class="fas fa-spinner fa-spin fa-3x fa-fw"></i>
<span class="sr-only">{{ site.data.ui-text[site.locale].loading_label | default: "Loading..." }}</span>
Expand Down Expand Up @@ -168,4 +168,4 @@ <h4 class="page__comments-title">{{ site.data.ui-text[site.locale].comments_labe
{% when "custom" %}
<section id="custom-comments"></section>
{% endcase %}
</div>
</div>
1 change: 1 addition & 0 deletions docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ staticman:
type : # "date"
options:
format : # "iso8601" (default), "timestamp-seconds", "timestamp-milliseconds"
endpoint : # URL of your own deployment with trailing slash, will fallback to the public instance
reCaptcha:
siteKey : "6LdRBykTAAAAAFB46MnIu6ixuxwu9W1ihFF8G60Q"
secret : "PznnZGu3P6eTHRPLORniSq+J61YEf+A9zmColXDM5icqF49gbunH51B8+h+i2IvewpuxtA9TFoK68TuhUp/X3YKmmqhXasegHYabY50fqF9nJh9npWNhvITdkQHeaOqnFXUIwxfiEeUt49Yoa2waRR7a5LdRAP3SVM8hz0KIBT4="
Expand Down
7 changes: 5 additions & 2 deletions docs/_docs/05-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,9 @@ Transform user comments into `_data` files that live inside of your GitHub repos
**Note:** Looking to migrate comments from a WordPress based site? Give [this tool](https://github.com/arthurlacoste/wordpress-comments-jekyll-staticman) a try.
{: .notice--info}

**Note:** Please note that as of September 2018, Staticman is reaching GitHub API limits due to its popularity, and it is recommended by its maintainer that users deploy their own instances for production (use `site.staticman.endpoint`).
{: .notice--warning}

##### Add Staticman as a Collaborator

1. Allow Staticman push access to your GitHub repository by clicking on **Settings**, then the **Collaborators** tab and adding `staticmanapp` as a collaborator.
Expand Down Expand Up @@ -389,8 +392,8 @@ These settings need to be added to your `_config.yml` file as well:
repository : # GitHub username/repo-name e.g. "mmistakes/minimal-mistakes"
comments:
provider : "staticman_v2"
staticman:
branch : "master"
staticman:
branch : "master"
```

**Branch setting:** This is the branch comment files will be sent to via pull requests. If you host your site on GitHub Pages it will likely be `master` unless your repo is setup as a project --- use `gh-pages` in that case.
Expand Down
1 change: 1 addition & 0 deletions test/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ staticman:
type : "date"
options:
format : "iso8601" # "iso8601" (default), "timestamp-seconds", "timestamp-milliseconds"
endpoint : # URL of your own deployment with trailing slash, will fallback to the public instance
atom_feed:
path : # blank (default) uses feed.xml
search : true # true, false (default)
Expand Down

0 comments on commit 4bd6efc

Please sign in to comment.