基于 Github Issues 的单页面静态博客 - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
爱意满满的作品展示区。
wuhaoworld
V2EX    分享创造

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

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

    玉伯的博客 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
    xzl380
        5
    xzl380  
       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 我怎么没想到....
    ConteMan
        20
    ConteMan  
       2015-06-18 09:08:07 +08:00
    赞一个 nice!
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     2602 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 29ms UTC 13:42 PVG 21:42 LAX 05:42 JFK 08:42
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86