Total Pageviews

Tuesday, 19 November 2013

基于纯js的静态博客程序-JSBlog

git clone https://github.com/hugcoday/hugcoday.github.com.git hugcoday
cd hugcoday
cd post
(在post文件夹下新建文件,文件名为:yyyy-mm-dd-posttitle.md,例如:2012-12-12-hello-world.md,格式如下:
#测试1

这是测试1.

as3:~/hugcoday/post# cat 2013-11-19-test1.md
#测试1

这是测试1.
as3:~/hugcoday/post# nano index.json
(然后编辑index.json文件,在"articles":[一行的下一行添加如下蓝色部分:
 "articles":[
{"title": "中国经济", "file": "2013-11-19-chinese-economy", "cate":"tech"},
{"title": "测试2", "file": "2013-11-19-test2", "cate":"tech"},
{"title": "测试1", "file": "2013-11-19-test1", "cate":"tech"},


 每新建一个md文件后,都要修改index.json,在"articles":[一行的下一行添加一行内容,比如:
 {"title": "测试1", "file": "2013-11-19-test1", "cate":"tech"},   
这样,网站就自动更新了。

演示站点:http://hcd.brite.biz/
http://hcd.brite.biz/#show/2013-11-19-test1
http://hcd.brite.biz/#show/2013-11-19-test2
http://hcd.brite.biz/#show/2013-11-19-chinese-economy
http://hcd.brite.biz/#show/2013-11-19-wether-sunshine-or-rain
程序作者在github上的演示博客:hugcoday.github.com

 项目地址:https://github.com/hugcoday/hugcoday.github.com
源码包下载地址:https://github.com/hugcoday/hugcoday.github.com/archive/master.zip
源码包下载,解压,然后上传到虚拟主机空间,只要虚拟主机空间支持js脚本(一般都是支持的),那么这个源码在虚拟主机空间也是可以使用的。

访问长文(比如http://hcd.brite.biz/#show/2013-11-19-chinese-economy)时,需等候3-4秒,文章才会显示。
-------------------------------------------------------------------
 基于纯js的静态博客程序-小田田

git clone https://github.com/onlytiancai/xiaotiantian.git  xiaotiantian-blog
cd xiaotiantian-blog
as3:~/xiaotiantian-blog# ls
index.html  main.js  meta.js  post  README.md

(可见 ~/xiaotiantian-blog/就是静态网站的根目录)
cd post
按post目录里的 2012-01-23.txt,先新建帖子2013-11-21-test2.txt,格式如下:
## 测试2
这是测试2.
as3:~/xiaotiantian-blog/post# ls
2012-01-23.txt  2013-11-21-chinese-economy.txt
2012-02-23.txt  2013-11-21-test2.txt
2012-03-23.txt  2013-11-21-wether-sunshine-or-rain.txt
2013-11-19.txt  index.txt

as3:~/xiaotiantian-blog/post# cat 2013-11-21-test2.txt
## 测试2
这是测试2.
as3:~/xiaotiantian-blog/post# cd ..
as3:~/xiaotiantian-blog# nano meta.js 

 (然后修改meta.js文件。在"articles"的下面添加帖子的信息,见下面的蓝色部分。保存更改,网站就更新了)
as3:~/xiaotiantian-blog# cat meta.js
{
    "site_name": "小天天博客",
    "copyright": "wawasoft 2012",
    "cates": [
        {"name": "tech", "text":"技术"},
        {"name": "art", "text":"艺术"},
        {"name": "other", "text":"其它"},
        {"name": "misc", "text":"杂项"}  ("cates"的最下一行的末尾不能加,号。)
    ],
    "articles":[
        {"title": "tech hello world", "file": "2012-01-23", "cate":"tech"},
        {"title": "art hello world", "file": "2012-02-23", "cate":"art"},
        {"title": "other hello world", "file": "2012-03-23", "cate":"other"},
        {"title": "测试1", "file": "2013-11-19", "cate":"misc"},
        {"title": "测试2", "file": "2013-11-21-test2", "cate":"misc"},
        {"title": "风雨无阻", "file": "2013-11-21-wether-sunshine-or-rain", "cate":"misc"}

"articles"的最下一行的末尾也不能加,号                                                                     
        ]
}
as3:~/xiaotiantian-blog#


演示站点:http://xtt.brite.biz
项目地址:https://github.com/onlytiancai/xiaotiantian

访问http://xtt.brite.biz/,会发现最新的帖子在左侧栏的最下面而非最上面。
 把以上"articles"中帖子的顺序颠倒,则最新的帖子就会出现在左侧栏的最上面了。
 -----------------------------------
https://github.com/jashkenas/underscore