mmistakes / minimal-mistakes

:triangular_ruler: Jekyll theme for building a personal site, blog, project documentation, or portfolio.
https://mmistakes.github.io/minimal-mistakes/
MIT License
12.44k stars 25.63k forks source link

Unable to display comment form with staticman v3 #2034

Closed cloudwheels closed 5 years ago

cloudwheels commented 5 years ago

I've read #2031 I'm unable to get a static man comment form to show up. My repo is here: https://github.com/hortigraph/hortigraph.github.io/ I've authorised the v3 staticman app

In my _config.yml I've enabled staticman_v2 as provider. comments: true is defaulf front matter for my collection "rhs"

1) I am unclear from the documentation about whether the endpoint property should be the full URL or the repo & branch are appended., ie should it be: "https://dev.staticman.net/v3/entry/github/hortigraph/hortigraph.github.io/master/"

2) The documentation says:

Bewteen v3 and /entry, one needs to input a Git service provider (either github or gitlab).

The staticman site suggests otherwise, ie. the provider is AFTER v3/entry/ - I guess this is the correct version and docs need an update?

There's a few issues popping up by the minute on the staticman site about the new v3 app, so could just be dancing along the bleeding edge here and it may be a staticman issue, but it would be great to get some pointers on the correct set up for the theme.

cloudwheels commented 5 years ago

An empty comment section is being generated, but no input form: do I need to add a form myself?

<div class="page__comments"> 
   <section id="static-comments">
   </section>
</div>
mmistakes commented 5 years ago

As mentioned in the other issue, I haven’t used v3 nor did I work on the pull request to add it. I probably won’t be much help because of this.

The documention is lacking because of this. You’d be better off looking at the source code to see what it accepts. Checking there you’ll see endpoint is the full URL as you have above.

ccing @maxime-michel as he added the PR that added the Staticman endpoint config.

cloudwheels commented 5 years ago

@sseneca can I please ask whether you got staticman v3 running after #2031

cloudwheels commented 5 years ago

@mmistakes many thanks for the quick response and whilst I'm here ABSOLUTELY HUGE THANKS for all your amazing work with this repo - she's a beauty! Will keep track & contrib if I can.

maxime-michel commented 5 years ago

I've never used v3 either, what does it bring to the table?

With v2 you'd want the endpoint property to look something like https://your-private-staticman-deploy.heroku.com/v2/entry/.

sseneca commented 5 years ago

@sseneca can I please ask whether you got staticman v3 running after #2031

Yeah, I did. Extract of _config.yml:

staticman:
  allowedFields          : ['name', 'email', 'url', 'message']
  branch                 : "master"
  commitMessage          : "New comment by {fields.name}"
  filename               : comment-{@timestamp}
  format                 : "yml"
  moderation             : true
  path                   : "/_data/comments/{options.slug}" # (default)
  requiredFields         : ['name', 'email', 'message']
  transforms:
    email                : "md5"
  generatedFields:
    date:
      type               : "date"
      options:
        format           : "iso8601" # (default) "timestamp-seconds", "timestamp-milliseconds"
  endpoint               : "https://dev.staticman.net/v3/entry/github/" # URL of your own deployment with trailing slash, will fallback to the public instance

Otherwise be sure to remove the old v2 staticmanapp as a contributor and install the v3 app to the correct repo. Then things should work fine.

sseneca commented 5 years ago

I've never used v3 either, what does it bring to the table?

v2 was getting rate limited, see https://github.com/eduardoboucas/staticman/issues/243#issue-389697095. v3 fixes this because now it's an app rather than a GitHub user.

cloudwheels commented 5 years ago

LINE 30 of _includes/comments.html {% if site.repository and site.staticman.branch %}

need to be {% if site.repository and site.comments.staticman.branch %}

This shows the form - will see if I can get to work now!

@sseneca did you need to make this change, or should the site.staticman.branch key pickup from staticman.yml (I am a complete Jekyll noob)

cloudwheels commented 5 years ago

There's a bit of fiddling to do to get the form appearing and talking to the v3 staticman API / github app. Unfortunately I'm getting 500 errors back, which may be the config or may be the staticman api. There's seems to be a bit of confusion around how _config.yml and staticman.yml are used (by the theme to generate the POST request and by the staticman API itself), and I think there's a PR needed around the docs for this at least. Not quite at the bottom of it yet but will do my best to feedback and put in a PR if I can.

sseneca commented 5 years ago

@sseneca did you need to make this change, or should the site.staticman.branch key pickup from staticman.yml (I am a complete Jekyll noob)

I didn't touch anything else. All I did was add staticman.yml and make the changes I mentioned above in _config.yml.

cloudwheels commented 5 years ago

As per cross referenced issue above, I'm up and running with staticman v3 comments.

I think the bundled staticman.yml was the problem, so this may need changing, along with docs and perhaps a reworking of _config.yml and _includes/comments.html

I think it would be pretty easy to add staticman_v3 to the comment provider list: basically unless people want to go to the trouble of setting up their own api to run the v2 backend this, after adding the gitlab app, pretty much has to become default anyway,as v2 is essentially 'broken'.

A few hours to catch up now!, but will work towards a PR when I can.

Comment from staticman issue included below for reference. Thanks for all the responses everybody 👍

@dancwilliams @unpreceden7ed and all. I am at peace.

In the chain of things this MUST boil down to the content of my staticman.yml (unless the test after reinstalling the app didn't reflect that change) I replaced with the standard sample: https://github.com/eduardoboucas/staticman/edit/master/staticman.sample.yml changing only the sitename.

So, thanks for this great advancement @eduardoboucas : 3 more confirmed happy customers for v3 within the last hour. Perhaps some clarification on docs & improved error messages needed?

My issues are all user support, so no follow up required thanks, but I will report this back to mmistakes/minimal-mistakes#2034 as referncved earlier which may need changes to the bundled staticman.yml

VincentTam commented 5 years ago

@cloudwheels and all Sorry for introducing this error in #1956. You're right about the v3 URL: it should be like

https://endpoint/v3/entry/git{hub|lab}/user/repo/branch/property
cloudwheels commented 5 years ago

@VincentTam no probs: it made for a fun Saturday night and a few peoples' issues with the v3 api got fixed in the process :) I will close this issue now as it's chatter and my problem is resolved, but have created #2036 to follow up.

VincentTam commented 5 years ago

Hi everyone,

I've just corrected the documentation about Staticman v3 URL scheme. Sorry for the confusion over these few months. In the updated documentation, I've added a sample config and a URL to the relevant Staticman PR for reference.

slowbreathing commented 5 years ago

Is there complete documentation for getting it to work with Jekyll based Github blog. I could never get it to work.

VincentTam commented 5 years ago

Is there complete documentation for getting it to work with Jekyll based Github blog. I could never get it to work.

@slowbreathing Since everyone is using a different version, it's hard to have one. For a self-contained starter, you may try https://github.com/daattali/beautiful-jekyll#staticman-comments. An illustrated version of this would be the second section of https://github.com/einsteinpy/blog.einsteinpy.org/issues/12.

For a working example of MM + Staticman, you might see https://lstu.fr/mmsm19 (source).

:information_source: Staticman docs asks users to add @staticmanapp, which no longer serves users.

slowbreathing commented 5 years ago

i am using leonids theme. here is the error i get. :404},"errorCode":"GITHUB_WRITING_FILE"}

slowbreathing commented 5 years ago

staticman v3

VincentTam commented 5 years ago

@slowbreathing It would be better if you can give us a link to your repo: https://github.com/slowbreathing/slowbreathing.github.io, so that we can have a look.

Please take a look at my article about Staticman errors. It gives possible reasons for different types of errors. You may also try the web developer tools in a modern web browser to see what's wrong with your requests.

slowbreathing commented 5 years ago

link to my repo is https://github.com/slowbreathing/slowbreathing.github.io

On Sat, Jul 27, 2019 at 9:01 PM Vincent Tam notifications@github.com wrote:

@slowbreathing https://github.com/slowbreathing It would be better if you can give us a link to your repo: https://github.com/slowbreathing/slowbreathing.github.io, so that we can have a look.

Please take a look at my article about Staticman errors https://vincenttam.gitlab.io/post/2018-12-25-staticman-repo-setup-errors/. It gives possible reasons for different types of errors. You may also try the web developer tools in a modern web browser to see what's wrong with your requests.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mmistakes/minimal-mistakes/issues/2034?email_source=notifications&email_token=AA2FEIYEDVMBDGACRS2M27LQBRS3LA5CNFSM4GRE4EN2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD26NQNQ#issuecomment-515692598, or mute the thread https://github.com/notifications/unsubscribe-auth/AA2FEI2MXRLHZQOZZ5JOCBDQBRS3LANCNFSM4GRE4ENQ .

audipen commented 4 years ago

@cloudwheels , is this 'https://github.com/hortigraph/hortigraph.github.io/blob/master/_config.yml' the final working version of your config with v3 of the staticman API? I have hosted staticman on heroku and I'm trying to get it working on a 'minimal mistakes' fork but can't get beyond this stage.

Can you post a working version of your config and detail any other steps that need to be taken ?

cloudwheels commented 4 years ago

Hi, That site isn't really active in afraid but that was the last working version. There's a fair chance something in Staticman has changed rather than MM. Try posting a comment to see if it's still working? I can have a better look later...

On Tue, 3 Mar 2020, 15:11 Aditya, notifications@github.com wrote:

@cloudwheels https://github.com/cloudwheels , is this ' https://github.com/hortigraph/hortigraph.github.io/blob/master/_config.yml' the final working version of your config with v3 of the staticman API? I have hosted staticman on heroku and I'm trying to get it working on a 'minimal mistakes' fork but can't get beyond this https://github.com/mmistakes/minimal-mistakes/issues/2034#issuecomment-455795885 stage.

Can you post a working version of your config and detail any other steps that need to be taken ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mmistakes/minimal-mistakes/issues/2034?email_source=notifications&email_token=AKTEKOFCTMGE3Q5MIDOUZ73RFUM2LA5CNFSM4GRE4EN2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENT3TKY#issuecomment-594000299, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKTEKOEEZZJI5LBWHNBGOE3RFUM2LANCNFSM4GRE4ENQ .