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

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

  •  3
     
  •   wuhaoworld · Jun 12, 2015 · 6286 views
    This topic created in 3988 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
        1
    wph95  
       Jun 12, 2015
    已star 棒:)
    IndexXuan
        2
    IndexXuan  
       Jun 12, 2015
    收了,准备试试。感谢分享
    djyde
        3
    djyde  
       Jun 12, 2015
    很酷,已 star & watch。持续关注。

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

    我?

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