Total Pageviews

Wednesday, 9 April 2014

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

git clone https://github.com/felixge/node-romulus
cd node-romulus
npm install

as3:~/node-romulus# ls
bin      index.js  LICENSE       package.json  romulus.jpg
example  lib       node_modules  README.md
as3:~/node-romulus# cd example
as3:~/node-romulus/example# ls
index.html  layouts  pages  public
as3:~/node-romulus/example#
as3:~/node-romulus/example# ~/node-romulus/bin/romulus build (这个就是生成/更新静态网站的命令)
You static empire was built in "/root/node-romulus/example/build" (took 60 ms)
as3:~/node-romulus/example# ls
build  index.html  layouts  pages  public
(新出现了build目录)
as3:~/node-romulus/example# cd build
as3:~/node-romulus/example/build# ls
css  index.html  markdown-rocks.html
(可见~/node-romulus/example/build/就是静态网站的根目录)
as3:~/node-romulus/example/build# nohup Rwebserver 45238 > /dev/null &
访问http://as3.brite.biz:45238/即可看到网站效果。

发贴方法:
as3:~/node-romulus/example/build# cd ..
as3:~/node-romulus/example# ls
build  index.html  layouts  pages  public
as3:~/node-romulus/example# cd pages
as3:~/node-romulus/example/pages# ls
index.html  markdown-rocks.md
as3:~/node-romulus/example/pages# cat markdown-rocks.md
<% this.layout = 'default'; %>

Markdown is **fun**, and you can still use EJS inside of your markdown
templates.
as3:~/node-romulus/example/pages# nano mountain-song.md
格式为:
<% this.layout = 'default'; %>

此处写正文或html code.

然后,
as3:~/node-romulus/example/pages# nano index.html
as3:~/node-romulus/example/pages# cat index.html
<% this.layout = 'default' %>
<p>Hello World</p>
<p><a href=/markdown-rocks.html>markdown-rocks</a></p>
<p><a href=/mountain-song.html>山歌好比春江水</a></p>
as3:~/node-romulus/example/pages# cd ..
as3:~/node-romulus/example# ~/node-romulus/bin/romulus build

演示站点:http://as3.brite.biz:45238/,
项目地址:https://github.com/felixge/node-romulus