Commit b8571ac6 authored by Vincent Tam's avatar Vincent Tam

Post: Staticman v3 Fixed incorrect content

parent 2678b70a
Pipeline #37015809 passed with stages
in 31 seconds
......@@ -55,13 +55,13 @@ In case of doubts, you may view
- [my demo project][demo] ([Source][demo_src])
- [my API instance][staticman3] ([Source][staticman3_src])
<i class="fas fa-info-circle fa-fw" aria-hidden></i>
<i class="fas fa-info-circle fa-lg fa-pull-left" aria-hidden></i>
What #3 does is to send data from an HTML `<form>` (as a POST request) to the
API server, which instructs #2 the GitLab bot to create merge request to #1 the
GitLab repo for your blog.
<i class="fas fa-question-circle fa-fw" aria-hidden></i>
<i class="fas fa-question-circle fa-lg fa-pull-left" aria-hidden></i>
If you're _unsure_ what my API instance do, I'll invite you to view
[its source code][staticman3_src]. In particular,
[my customizations against `staticman/dev` branch][staticman3_diff].
......@@ -69,12 +69,47 @@ If you're _unsure_ what my API instance do, I'll invite you to view
1. In your GitLab project page, go to **Settings → Members**.
2. Grant the GitLab bot "**developer**" access.
The [setup guide in Staticman PR&nbsp;219][pr219] claims that at this point,
you would be able to post comments. However, as can be seen from my
**(Edited on Nov 18, 2018, as a follow-up to
According to the [setup guide in Staticman PR&nbsp;219][pr219], at this
point, you'll be able to post comments. ~~However, as can be seen from my
comments, I stopped messing things up after including my OAuth application
ID and secret for authenticated comments in config file `staticman.yml`.
Even though I'm _not_ 100% sure if the steps 3--6 are required, I advise you
following them.
following them.~~
Steps 3--7 are _optional_ steps for _authenticated comments_. You may
**copy a suitable** `staticman.yml` **file from your blogging theme,
change/delete the reCaptcha key, and **proceed with step&nbsp;8**. (say,
the one from [Beautiful Hugo][bh])
{{< highlight yaml "linenos=inline" >}}
allowedFields: ["name", "email", "website", "comment"]
branch : "master"
commitMessage : "New comment in {options.slug}"
path: "data/comments/{options.slug}"
filename : "comment-{@timestamp}"
format : "yaml"
moderation : true
requiredFields : ['name', 'email', 'comment']
email : md5
type : "date"
format : "iso8601"
enabled: true
siteKey: "6LeGeTgUAAAAAAqVrfTwox1kJQFdWl-mLzKasV0v"
secret: "hsGjWtWHR4HK4pT7cUsWTArJdZDxxE2pkdg/ArwCguqYQrhuubjj3RS9C5qa8xu4cx/Y9EwHwAMEeXPCZbLR9eW1K9LshissvNcYFfC/b8KKb4deH4V1+oqJEk/JcoK6jp6Rr2nZV4rjDP9M7nunC3WR5UGwMIYb8kKhur9pAic="
{{< /highlight >}}
For instance, you may view [my second demo site][demo2] (with
[*proper* comment reply support][comment_rep]) and [its source][demo2_src].
3. Under your **account settings**, choose **Applicatons**.
4. Add a new application (for visitors to authenticate themselves on your site).
......@@ -143,7 +178,7 @@ the address bar of your web browser.
path: "data/comments/{options.slug}"
<i class="fas fa-exclamation-circle fa-fw" aria-hidden></i>
<i class="fas fa-exclamation-circle fa-lg fa-pull-left" aria-hidden></i>
[Staticman] is only responsible for delivering the comments from
commentators to the site owner's designated `path` (inside the GitLab
repo). You have to consult your blog template's README / documentation in
......@@ -162,7 +197,7 @@ the address bar of your web browser.
$ git grep '<form'
layouts/partials/staticman-comments.html:<form class="js-form form" method="post
" action="{{ .Site.Params.staticman.api}}">
" action="{{ .Site.Params.staticman.api }}">
The code `.Site.Params.staticman.api` is found, meaning that Staticman's
`api` has to be configured.
......@@ -205,7 +240,7 @@ the address bar of your web browser.
secret = "hsGjWtWHR4H...ur9pAic="
<i class="fas fa-exclamation-triangle fa-fw" aria-hidden></i>
<i class="fas fa-exclamation-triangle fa-lg fa-pull-left" aria-hidden></i>
Use my API instance for _testing and educational_ purposes only. _Never_ use it
for production since Heroku free dynos _aren't_ for that. (Free dynos idle
after 30&nbsp;minutes of inactivity.)
......@@ -274,3 +309,7 @@ drop-down list, _uncheck "Masters" and check "Developers + Masters"_.
[next]: /post/2018-09-16-staticman-powered-gitlab-pages/2/
[comment_rep]: /post/2018-11-17-nested-comments-in-beautiful-hugo/
......@@ -13,7 +13,7 @@ draft: false
### Quick links
1. [A minimal demo site on GitLab][demo] ([Source][demo_scr])
1. [A minimal demo site on GitLab][demo] ([Source][demo_src])
2. [Beautiful Hugo pull request 222][8]
3. [Pre-release notes for this pull request][9]
......@@ -317,3 +317,5 @@ content
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment