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

GitHub Issue as a Blog #72

Closed
dylanninin opened this issue May 8, 2023 · 1 comment
Closed

GitHub Issue as a Blog #72

dylanninin opened this issue May 8, 2023 · 1 comment
Milestone

Comments

@dylanninin
Copy link
Owner

dylanninin commented May 8, 2023

如何使用 GitHub Issues 作为博客,这里介绍一种简单的实现。


基本概念

  • issue:每个 issue 即是一篇博文
  • labels:对应博文的 tags
  • milestone:对应博文的 categories

主要场景,如文章的发布、更新、删除都可以完成,操作上十分方便

  • 写一篇文章时,可以利用 GitHub Issues 强大的编辑功能,支持 Markdown,所见即所得
  • 发布文章时,2 步:
    • 1)添加的 label 为 post;带有 post 标签的 issues 才会导出为博客。
    • 2)关闭 issue,开始博文发布流程。
  • 更新文章时,3 步
    • 1)重新打开 issue
    • 2)编辑对应的 issue
    • 3)关闭 issue
  • 删除文章时,3 步
    • 1)重新打开 issue
    • 2)移除标签 post
    • 3)关闭 issue

实现原理

image

GitHub Pages:https://pages.github.com/,GitHub 提供的静态文件托管服务,开源仓库可以免费使用。

GitHub Actions:Actions Doc,GitHub 提供的 CI 工具,也是最好用的 CI 工具,开原仓库也可以免费使用。

导出 issue 为文章:Workflow,稍微写点代码就行。

GitHub 仓库中做一些如下设置

image


为什么要这样做?

静态博客托管在 GitHub Pages,要发布/更新文章,原始的方式就像编写代码一样编写 markdown,同时需要 commit 之后才能发布,过程较为麻烦;如果遇到一些显示样式问题,或者要重新编辑,也会很繁琐。

GitHub Issues 功能强大,同时提供所见即所得的 markdown 编写体验,能自动保存,还可以分段编辑,使用起来十分方便、友好, 这就是一个天然的编辑器。

同时 GitHub API 非常完善,比如 Introduction — PyGithub,做自动化发布非常容易。

基于 GitHub 提供的各项服务,就可以得到一个既能静态托管、又能所见即所得的编辑、还能提供 API 的博客了,当然还可以多人协同写作。

@dylanninin dylanninin added this to the Post milestone May 8, 2023
@dylanninin
Copy link
Owner Author

dylanninin commented May 8, 2023

这篇文章,就是使用 GitHub Issues 作为博客,原文

image

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

1 participant