Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to display comment form with staticman v3 #2034

Closed
cloudwheels opened this issue Jan 19, 2019 · 22 comments
Closed

Unable to display comment form with staticman v3 #2034

cloudwheels opened this issue Jan 19, 2019 · 22 comments

Comments

@cloudwheels
Copy link

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
Copy link
Author

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
Copy link
Owner

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
Copy link
Author

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

@cloudwheels
Copy link
Author

@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
Copy link
Contributor

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
Copy link

sseneca commented Jan 19, 2019

@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
Copy link

sseneca commented Jan 19, 2019

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

v2 was getting rate limited, see eduardoboucas/staticman#243 (comment). v3 fixes this because now it's an app rather than a GitHub user.

@cloudwheels
Copy link
Author

cloudwheels commented Jan 19, 2019

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
Copy link
Author

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
Copy link

sseneca commented Jan 19, 2019

@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
Copy link
Author

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 #2034 as referncved earlier which may need changes to the bundled staticman.yml

@VincentTam
Copy link
Contributor

VincentTam commented Jan 20, 2019

@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
Copy link
Author

@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
Copy link
Contributor

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
Copy link

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

@VincentTam
Copy link
Contributor

VincentTam commented Jul 27, 2019

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 einsteinpy/blog.einsteinpy.org#12.

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

ℹ️ Staticman docs asks users to add @staticmanapp, which no longer serves users.

@slowbreathing
Copy link

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

@slowbreathing
Copy link

staticman v3

@VincentTam
Copy link
Contributor

@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
Copy link

slowbreathing commented Jul 28, 2019 via email

@audipen
Copy link

audipen commented Mar 3, 2020

@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
Copy link
Author

cloudwheels commented Mar 3, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants