爱意满满的作品展示区。
wuhaoworld

基于 Github Issues 的单页面静态博客

  •  3
     
  •   wuhaoworld · Jun 12, 2015 · 6731 views
    This topic created in 4180 days ago, the information mentioned may be changed or developed.

    玉伯的博客 https://github.com/lifesinger/lifesinger.github.com/issues 让我第一次知道 github issues 还可以这样用 ,作者发了很多干货技术文章,让我不由得感叹 ,文章不在于形式,也不在于写在哪里,只要是好文,总不会被埋没。

    即便如此,很多人仍然希望能有一个独立域名、可以自由修改主题的博客。Wordpress 、Typecho 太重,还要买 VPS、部署服务器环境、安装插件、主题,太折腾人,于是我想,完全可以利用 Github 提供的 API 来实现一个只有一个静态页面的博客,具体思路如下:

    1. 作者在 Github issues 上写文章(写 issues)
    2. 博客页面通过 JS Ajax 请求 Github API 来获取文章内容,进行页面的渲染
    3. 通过社会化评论插件实现评论功能

    于是花了几天时间实现了这个设想, 项目地址:https://github.com/wuhaoworld/github-issues-blog,内有部署相关文档。

    DEMO:http://wuhaoworld.github.io/

    博客的 demo 内容是读取的玉伯博客的 issues。

    PS:使用到的技术:

    1. Ractive.js 做模板
    2. Director.js 做路由
    3. markdown-js 做 markdown 的解析
    20 replies  •  2015-06-18 09:08:07 +08:00
    wph95
    wph95
    Jun 12, 2015
    1
    已star 棒:)
    IndexXuan
    IndexXuan
    Jun 12, 2015
    2
    收了,准备试试。感谢分享
    djyde
    djyde
    Jun 12, 2015
    3
    很酷,已 star & watch。持续关注。

    另外可以试试 Vue.js
    acthtml
    acthtml
    Jun 12, 2015
    4
    github page 支持很多markdown形式的博客,不用自己写。例如jekylle
    xzl380
    xzl380
    Jun 12, 2015
    5
    cool!
    另外如果可以利用Labels进行分类就更好了。
    stiekel
    stiekel
    Jun 12, 2015
    6
    这想法真不错。
    marginleft
    marginleft
    Jun 12, 2015 via Android
    7
    好思路,赞!
    isaced
    isaced
    Jun 12, 2015
    8
    速度很快,赞!
    loveminds
    loveminds
    Jun 12, 2015
    9
    可以搞个“鸡盒歌床”项目,做图床略慢
    skyshy
    skyshy
    Jun 13, 2015
    10
    我也star
    loading
    loading
    Jun 13, 2015
    11
    这里很多人都是 blogging 而不是 writing。

    我?

    酒知道么?我把它放一边,然后它会。。。臭掉!
    bydgd
    bydgd
    Jun 13, 2015
    12
    感觉没有必要啊,原来已经很好了*o*
    chaos186
    chaos186
    Jun 14, 2015
    13
    @wuhaoworld
    访问了一下测试页面,为什么博客文章可以加载的那么快啊!
    求科普
    mingyun
    mingyun
    Jun 14, 2015
    14
    赞,star
    wuhaoworld
    wuhaoworld
    OP
    Jun 14, 2015
    15
    @chaos186 在文章列表页调用 issues 列表接口时其实就已经把 issues 的内容都请求下来了,然后把内容直接保存在了一个全局变量中,进入详情页后直接从全局变量中拿内容,就不用再去请求接口了。
    baka
    baka
    Jun 15, 2015
    16
    太酷炫,已经用上了。
    lisposter
    lisposter
    Jun 15, 2015
    17
    一个问题 access token 暴露在前端了,不够安全
    wuhaoworld
    wuhaoworld
    OP
    Jun 15, 2015
    18
    @lisposter 限制这个 token 只能访问公开 repo 了,所以没什么安全隐患。 因为不用 token 也是可以访问公开 repo 的,只是起到提高配额的作用。
    chaos186
    chaos186
    Jun 17, 2015
    19
    @wuhaoworld 赞! MD 我怎么没想到....
    ConteMan
    ConteMan
    Jun 18, 2015
    20
    赞一个 nice!
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1922 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 797ms · UTC 12:13 · PVG 20:13 · LAX 04:13 · JFK 07:13
    ♥ Do have faith in what you're doing.