Total Pageviews

Tuesday, 8 April 2014

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

git clone https://github.com/koostudios/kel
cd kel
npm install

as3:~/kel# ls
bin  lib  node_modules  npm-shrinkwrap.json  package.json  README.md
as3:~/kel# ls bin
kel
as3:~/kel# ./bin/kel
usage: kel [-v] <command>
commands:
kel <path>: Creates a new kel site
kel generate <path>: Generates a static kel site into the public folder
as3:~/kel# ~/kel/bin/kel kel-site (此命令会在当前目录下,生成kel-site目录)
显示:
Creating a kel site in kel-site...
   create : kel-site
   create : kel-site/public
   create : kel-site/templates
   create : kel-site/pages
   create : kel-site/posts
   create : kel-site/public/css
   create : kel-site/public/blog
   create : kel-site/templates/pages.jade
   create : kel-site/templates/posts.jade
   create : kel-site/pages/index.md
   create : kel-site/posts/hello.md
   create : kel-site/public/css/style.css
as3:~/kel# ls
bin  kel-site  lib  node_modules  npm-shrinkwrap.json  package.json  README.md
as3:~/kel# cd kel-site
as3:~/kel/kel-site# ls
pages  posts  public  templates
as3:~/kel/kel-site# ~/kel/bin/kel generate (这个就是生成/更新静态网站的命令)
显示:
Generating static site in /public...
   create : ./public/index.htm
   create : ./public/blog/index.htm
   create : ./public/blog/hello.htm
as3:~/kel/kel-site# ls
pages  posts  public  templates
as3:~/kel/kel-site# ls public
blog  css  index.htm
as3:~/kel/kel-site# cd public
as3:~/kel/kel-site/public#
as3:~/kel/kel-site/public# ls
blog  css  index.htm
(可见~/kel/kel-site/public/就是静态网站的根目录)
as3:~/kel/kel-site/public# nohup Rwebserver 43927 > /dev/null &
访问http://as3.brite.biz:43927/就可看到网站效果。
as3:~/kel/kel-site/public# cd blog
as3:~/kel/kel-site/public/blog# ls
chinese-economy.htm  hello.htm  index.htm  mountain-song.htm  super-talk.htm
(可见~/kel/kel-site/public/blog/也是静态网站的根目录)
as3:~/kel/kel-site/public/blog# nohup Rwebserver 46328 > /dev/null &
访问http://as3.brite.biz:46328/也可看到网站效果。
不过帖子的标题竟然不是超链。

发贴方法:
as3:~/kel/kel-site/public# cd ../posts
as3:~/kel/kel-site/posts# nano mountain-song.md
按~/kel/kel-site/posts/里面的hello.md的格式,新建帖子mountain-song.md,格式如下:
title: 山歌好比春江水
timestamp: Wed 9 Apr 2014 11:14:35 EST


此处写正文或html code.(上面需隔开2行)

然后,
as3:~/kel/kel-site/posts# cd ..
as3:~/kel/kel-site# ~/kel/bin/kel generate

演示站点:http://as3.brite.biz:43927/blog/,http://as3.brite.biz:46328/
项目地址:https://github.com/koostudios/kel