Skip to content

Conversation

@VincentTam
Copy link

Resolves #3 and #8. This is basically a minimised port of Beautiful Hugo's native Staticman support. I'm not expert in CSS, so I'll leave the that for any interested user(s).

Demo site on GitLab

Staticman now supports GitLab at https://vincenttam.gitlab.io/er-demo

Quick guide to test this pull request

If you're using a theme as a Git submodule (as recommended in Hugo's official tutorial), you may create a new (local/GitLab/etc) (private) repo for this theme and run these commands to get this PR merged against a testing branch staticman in the private repo. I denote the URL of this repo as the upstream.

$ git remote -v
upstream	https://github.com/lingxz/er.git (fetch)
upstream	https://github.com/lingxz/er.git (push)
... # other remote omitted
$ git checkout -b staticman # test on a new branch staticman
$ git fetch upstream pull/9/head # git pull will be rejected
$ git merge FETCH_HEAD # manually merge the this PR against branch staticman
$ cd <your-blog>
... # edit your .gitmodules with url="<repo-containing-staticman>" and branch = "staticman"
$ git submodule sync # inform Git the changes in .gitmodules
$ git submodule update --remote --recursive # switch to the HEAD of your cloned repo for the theme

@lingxz
Copy link
Owner

lingxz commented Dec 13, 2018

Hi @VincentTam, thanks, great work! I really like that you included a guide to test pout this branch as well, I think this will be really helpful for people who are looking to put in a comments block in their blog 👍

@VincentTam
Copy link
Author

VincentTam commented Dec 21, 2018

Setup Staticman for Hugo blog 2018

  1. Go to SettingsCollaborators and add @staticmanlab as a collaborator.

    screenshot from 2018-12-21 19-29-00

    N.B. On GitLab, the procedure is similar, but the next step can be omitted.

  2. Open the following link so that @staticmanlab can accept your invitation.

    https://staticman3.herokuapp.com/v3/github/connect/{username}/{repo-name}
    

    N.B. It's reported that the public API instance https://api.staticman.net in Cannot add collaborator - Invitation not found eduardoboucas/staticman#227.

  3. Edit config.toml. Change master to gh-pages if your project page is hosted on the gh-pages branch. Replace github with gitlab if your site is hosted on GitLab.

    [Params.staticman]
      api = "https://staticman3.herokuapp.com/v3/entry/github/{username}/{repo-name}/master/comments"
    #[Params.staticman.recaptcha]
      #sitekey = # "6LeGeTgUAAAAAAqVrfTwox1kJQFdWl-mLzKasV0v"
      #secret = # "hsGjWtWHR4HK4pT7cUsWTArJdZDxxE2pkdg/ArwCguqYQrhuubjj3RS9C5qa8xu4cx/Y9EwHwAMEeXPCZbLR9eW1K9LshissvNcYFfC/b8KKb4deH4V1+oqJEk/JcoK6jp6Rr2nZV4rjDP9M7nunC3WR5UGwMIYb8kKhur9pAic="
    

    The settings for reCAPTCHA is optional. Encrypt your site secret with

    https://staticman3.herokuapp.com/v3/encrypt/{site-secret}
    
  4. Edit staticman.yml so that the branch matches the branch on which your site is hosted, and that the reCAPTCHA parameters match those in your config.

    comments:
      allowedFields: ["name", "email", "website", "comment", "replyThread", "replyName", "replyID"]
      branch            : "master"
      reCaptcha:
        enabled: false
        siteKey: # "6LeGeTgUAAAAAAqVrfTwox1kJQFdWl-mLzKasV0v"
        secret:  # "hsGjWtWHR4HK4pT7cUsWTArJdZDxxE2pkdg/ArwCguqYQrhuubjj3RS9C5qa8xu4cx/Y9EwHwAMEeXPCZbLR9eW1K9LshissvNcYFfC/b8KKb4deH4V1+oqJEk/JcoK6jp6Rr2nZV4rjDP9M7nunC3WR5UGwMIYb8kKhur9pAic="
    

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants