编辑
在gitlab pages中使用staticman
本文访问次数:0
  1. 1. 创建staticmanapp
  2. 2. 创建trigger
  3. 3. 创建webhook

staticman是非常好用的静态博客评论实现,但是可惜只支持githubjekyll,不过通过使用github webhooksgitlab triggers功能就能实现在gitlab pages使用staticman。

创建staticmanapp

第一步要做的就是创建staticmanapp,按照官方文档操作即可,也可以查看我创建好的repository

创建trigger

在gitlab 项目菜单选择Triggers > Add trigger,然后复制下面的链接

curl -X POST \
     -F token=TOKEN \
     -F ref=REF_NAME \
     https://gitlab.com/api/v3/projects/1400576/trigger/builds

创建webhook

点击github 项目Settings>Webhooks>Add webhookPayload URL填写上面的链接,并添加参数,例如

https://gitlab.com/api/v3/projects/1400576/trigger/builds?token=5e763611ads5fb89598220414e334b&ref=master

注意将token替换

需要输入验证码才能留言

  • @宗仁    The original setup guide contains typo (about GitLab bot’s permissions). The GitLab repo setup and the API server setup are mixed together. You may see my repo setup walkthrogh and my custom API config to know more.

  • 宗仁 2018/09/15 回复 编辑 删除

    Thanks for telling me that,I will take a look at it.

  • Thanks for great article! Staticman API v3 now adds support for GitLab Pages. You may see my sample page for example.

  • 宗仁 2017/02/19 回复 编辑 删除

    @Kenneth Gonzalez    You are welcome

  • Kenneth Gonzalez 2017/02/19 回复 编辑 删除

    Thanks a lot. Finally I found the way to fix this problem. I am searing to work it.

  • 宗仁 2017/02/19 回复 编辑 删除

    the key is to add custom script to gitlab-ci.yml that clones the github repository before building and using the data in hexo theme

  • Kenneth Gonzalez 2017/02/19 回复 编辑 删除

    401 Unauthorized. It looks no permission to me for accessing this file.

  • 宗仁 2017/02/19 回复 编辑 删除

    You should read my gitlab-ci.yml

  • Kenneth Gonzalez 2017/02/19 回复 编辑 删除

    @宗仁: Sadly, not working at all. I don’t think trigger setting of gitlab is wrong due to no option in there. Can you explain how load the comments exported github repository?

    I was thinking the process is that merging the pull request in github -> commit to gitlab using API -> rebuild in gitlab using API. But it looks commit process is omitted,which is caused not showing the comments problem.

  • 宗仁 2017/02/19 回复 编辑 删除

    @Kenneth Gonzalez
    “Just push event”

  • Kenneth Gonzalez 2017/02/18 回复 编辑 删除

    How do you set up the github webhook? “Just push event” or “Pull request” or something like that? It was possible to comment the page even showing the posted comments is hard to do that.

  • 宗仁 2016/10/01 回复 编辑 删除

    由于staticman的工作原理,所以评论会延迟几分钟后出现,也就是hexo build和deploy 的时间。