Total Pageviews

Monday, 7 April 2014

在linux vps上搭建基于nodejs的静态博客程序-heckle

git clone https://github.com/marijnh/heckle
cd heckle

as3:~/heckle# ls
heckle.js  LICENSE  package.json  README.md  util.js
as3:~/heckle# npm install
as3:~/heckle# ls
heckle.js  LICENSE  node_modules  package.json  README.md  util.js
as3:~/heckle# git clone https://github.com/marijnh/blog marijnhaverbeke.nl-blog
as3:~/heckle# ls
heckle.js  marijnhaverbeke.nl-blog  package.json  util.js
LICENSE    node_modules             README.md
as3:~/heckle# cd marijnhaverbeke.nl-blog
as3:~/heckle/marijnhaverbeke.nl-blog# ls
_config.yml  feed.md  _includes  index.md  _layouts  _posts  res
(可以看出它的目录结构借鉴了jekyll的做法)
as3:~/heckle/marijnhaverbeke.nl-blog# node ~/heckle/heckle.js (这个就是生成/更新静态网站的命令)
as3:~/heckle/marijnhaverbeke.nl-blog# ls
_config.yml  feed.md  _includes  index.md  _layouts  _posts  res  _site
(新出现了_site目录)
as3:~/heckle/marijnhaverbeke.nl-blog# cd _site
as3:~/heckle/marijnhaverbeke.nl-blog/_site# ls
acorn.html                           http-caching.html
a-pathological-scrolling-model.html  index.html
browser-input-reading.html           interning.html
closure-vs-object-performance.html   mold.html
cl-tk.html                           null-and-undefined.html
codemirror-2.34-and-3beta1.html      parse-dammit.html
codemirror-line-tree.html            parse-js.html
codemirror-marked-ranges.html        pcall.html
codemirror-mode-system.html          postmodern-1.13.html
codemirror-shared-documents.html     postmodern-1.19.html
common-lisp-monads.html              res
cursor-in-bidi-text.html             st-json.html
feed.atom                            tern.html
heckle.html
as3:~/heckle/marijnhaverbeke.nl-blog/_site#
里面有index.html,可见~/heckle/marijnhaverbeke.nl-blog/_site/就是静态网站的根目录。
as3:~/heckle/marijnhaverbeke.nl-blog/_site# nohup Rwebserver 35623 > /dev/null &
访问http://as3.brite.biz:35623/就可看到网站效果。

发贴方法:
as3:~/heckle/marijnhaverbeke.nl-blog/_site# cd ..
as3:~/heckle/marijnhaverbeke.nl-blog# cd _posts
as3:~/heckle/marijnhaverbeke.nl-blog/_posts#
按里面的2013-07-25-null-and-undefined.md的格式,新建帖子2014-04-07-test1.md,格式如下:
---
layout: post
title: 测试1
tags:
- misc
---

这是测试1.


然后,
as3:~/heckle/marijnhaverbeke.nl-blog/_posts# cd ..
as3:~/heckle/marijnhaverbeke.nl-blog# node ~/heckle/heckle.js

演示站点:http://as3.brite.biz:35623/,http://hc.brite.biz.st
http://marijnhaverbeke.nl/blog/
项目地址:https://github.com/marijnh/heckle
https://github.com/marijnh/blog

可惜帖子的排列顺序不是按发表时间排列的。怎么修改都无济于事。