Total Pageviews

Sunday, 19 October 2025

搭建基于github issue的静态博客程序:blog-by-superleeyom

 首先,建议你新注册一个github账号。我用旧的github账号,未搭建成功:

https://briteming.github.io/slyb/

我新注册的github账号是yu826717。

我登录账号yu826717后,fork此项目https://github.com/superleeyom/blog,我fork后,得到的项目地址是https://github.com/yu826717/slyb 。然后访问https://github.com/settings/tokens/new,生成access token.(我选择的是classic模式。scope 如果不知道选啥,全部勾上)。把生成的access token记下来。然后点击settings: https://github.com/yu826717/slyb/settings, 点击左列的secrets and variables->actions->secrets tab, 点击Repository secret,

在Name栏,填G_T . 在Secret栏,填入刚刚生成的access token的值。然后点击Add secret.

访问 https://github.com/yu826717/slyb/issues/new/choose,选择Blank issue:

https://github.com/yu826717/slyb/issues/new?template=BLANK_ISSUE ,在此创建一个issue.

然后fork此项目https://github.com/superleeyom/superleeyom.github.io,我 fork后得到的项目地址是https://github.com/yu826717/sgi, 然后把项目名sgi重命名为yu826717.github.io

然后 修改 docs 目录和根目录下的两个 CNAME 文件。如果没有自定义域名,默认都填:你的github用户名.github.io

 修改 docs 目录下的 index.html 文件,比如我的:

window.config = {
  organization: false,// 默认是 false,如果你的项目是属于 GitHub 组织 的,请设置为 true
  order: 'CREATED_AT',// 文章排序,以 创建时间 或者 更新时间,可选值 'UPDATED_AT','CREATED_AT'
  title: "yu's Blog",// 博客标题
  user: 'yu826717',// GitHub 用户名,必须.
  repository: 'slyb',// GitHub项目名,指定文章内容来源 issues,必须.
  authors: 'yu',// 博客作者,以 ',' 分割,GitHub 用户名默认包含在内
  ignores: '',// 文章忽略的 issues ID
  hash: 'ghp_VkKID%Qnlgg$SXfIt!UmH&uCLCtHFU$XJHK^YmxvZy5sZWV5b20udG9w',// hash,必须
  perpage: 5,// 分页数量
}
这里的 hash的值要改为你的hash的值。其中关于 hash 的获取,参考「获取 hash」
在https://github.com/settings/tokens/new获取你的token。前面已经生成过 token.
在chrome 浏览器里访问网站https://blog.leeyom.top/,点击右上角的竖向的3小点- >更多工具->
开发者工具。从而打开 开发者工具 界面。在Github  https://github.com/LoeiFy/Mirror的
下一行的'>'的后面输入:
window.encrypt('我的github用户名yu826717的access token的值', 'yu826717.github.io')
然后按enter键,在下一行会显示一串字符,得到的字符就是 hash 串。把这串字符记录下来。
访问https://github.com/yu826717/yu826717.github.io/settings/pages,Source的值选择:
Deploy from a branch:

github用户名.github.io 仓库下,将 page 的 source 指向到master分支的docs目录。然后点击
save。若你没有自定义域名,Custom domain可以不用设置。
最后改下你的README.md(https://github.com/yu826717/yu826717.github.io/blob/master/README.md)
的内容。 我改为了:my personal blog built based on superleeyom/blog#38
 然后等个2分钟,访问你的域名,比如我的是yu826717.github.io,即可成功打开你的博客网站。

参考资料

演示网站: https://yu826717.github.io/

项目地址: https://github.com/superleeyom/blog

( https://github.com/yu826717/slyb)

 https://github.com/superleeyom/superleeyom.github.io

( https://github.com/yu826717/yu826717.github.io)

不足之处: 在此https://github.com/yu826717/slyb/issues/new?template=BLANK_ISSUE,仓库https://github.com/yu826717/slyb的非owner用户,比如briteming创建的issue-

https://github.com/yu826717/slyb/issues/12也能进入博客 - https://yu826717.github.io/#/posts/12。只是博客的首页并不显示该博文的标题链接, 所以读者并不知道该博文的存在。

 

 

 
 
 
 
 
 

 

 

No comments:

Post a Comment