V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
爱意满满的作品展示区。
wuhaoworld
V2EX  ›  分享创造

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

  •  3
     
  •   wuhaoworld · 2015-06-12 15:13:59 +08:00 · 5310 次点击
    这是一个创建于 3239 天前的主题,其中的信息可能已经有所发展或是发生改变。

    玉伯的博客 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 条回复    2015-06-18 09:08:07 +08:00
    wph95
        1
    wph95  
       2015-06-12 15:38:16 +08:00
    已star 棒:)
    IndexXuan
        2
    IndexXuan  
       2015-06-12 15:46:54 +08:00
    收了,准备试试。感谢分享
    djyde
        3
    djyde  
       2015-06-12 16:07:46 +08:00
    很酷,已 star & watch。持续关注。

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

    我?

    酒知道么?我把它放一边,然后它会。。。臭掉!
    bydgd
        12
    bydgd  
       2015-06-13 11:08:42 +08:00
    感觉没有必要啊,原来已经很好了*o*
    chaos186
        13
    chaos186  
       2015-06-14 11:23:24 +08:00
    @wuhaoworld
    访问了一下测试页面,为什么博客文章可以加载的那么快啊!
    求科普
    mingyun
        14
    mingyun  
       2015-06-14 13:37:05 +08:00
    赞,star
    wuhaoworld
        15
    wuhaoworld  
    OP
       2015-06-14 16:49:11 +08:00
    @chaos186 在文章列表页调用 issues 列表接口时其实就已经把 issues 的内容都请求下来了,然后把内容直接保存在了一个全局变量中,进入详情页后直接从全局变量中拿内容,就不用再去请求接口了。
    baka
        16
    baka  
       2015-06-15 09:32:19 +08:00
    太酷炫,已经用上了。
    lisposter
        17
    lisposter  
       2015-06-15 15:04:54 +08:00
    一个问题 access token 暴露在前端了,不够安全
    wuhaoworld
        18
    wuhaoworld  
    OP
       2015-06-15 15:32:17 +08:00
    @lisposter 限制这个 token 只能访问公开 repo 了,所以没什么安全隐患。 因为不用 token 也是可以访问公开 repo 的,只是起到提高配额的作用。
    chaos186
        19
    chaos186  
       2015-06-17 08:00:31 +08:00
    @wuhaoworld 赞! MD 我怎么没想到....
    Conte
        20
    Conte  
       2015-06-18 09:08:07 +08:00
    赞一个 nice!
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   987 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 19:50 · PVG 03:50 · LAX 12:50 · JFK 15:50
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.