Total Pageviews

Monday 23 June 2014

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

 (以下直到虚线的内容失效,请看虚线以下的内容)
git clone https://github.com/iansullivan88/bramble-mvc
cd bramble-mvc

root@as3:~/bramble-mvc# ls
bramble.js  lib         README.md  test.js
examples    LICENSE.md  package.json  test
root@as3:~/bramble-mvc# npm install
root@as3:~/bramble-mvc#
root@as3:~/bramble-mvc# ls
bramble.js  lib         node_modules  README.md  test.js
examples    LICENSE.md  package.json  test
root@as3:~/bramble-mvc# cd examples
root@as3:~/bramble-mvc/examples# ls
catblog
root@as3:~/bramble-mvc/examples# cd catblog
root@as3:~/bramble-mvc/examples/catblog# ls
application.js  lib  output
root@as3:~/bramble-mvc/examples/catblog# cd output
root@as3:~/bramble-mvc/examples/catblog/output# ls
blog  content  home  img  index.html
(可见~/bramble-mvc/examples/catblog/output/就是静态网站的根目录。)
root@as3:~/bramble-mvc/examples/catblog/output# nohup Rwebserver 5319 > /dev/null &
访问http://as3.brite.biz:5319/,http://as3.brite.biz:5319/blog即可看到网站效果。

发贴方法:
root@as3:~/bramble-mvc/examples/catblog/output# cd ..
root@as3:~/bramble-mvc/examples/catblog# ls
application.js  lib  output
root@as3:~/bramble-mvc/examples/catblog# cd lib
root@as3:~/bramble-mvc/examples/catblog/lib# ls
config  controller  data  view
root@as3:~/bramble-mvc/examples/catblog/lib# cd data
root@as3:~/bramble-mvc/examples/catblog/lib/data# ls
blog-repository.js 
root@as3:~/bramble-mvc/examples/catblog/lib/data# nano blog-repository.js
在如下段落的上一行,
{
    id:"introduction",
    title:"Introduction to Cats",
    date:new Date(2014, 5, 1),
    content:"The domestic cat (Felis catus or Felis silvestris catus) is a small, usually furry, domesticated, and carnivorous mammal. It is often called the housecat when kept as an indoor pet, or simply the cat when there is no need to distinguish it from other felids and felines. Cats are often valued by humans for companionship and their ability to hunt vermin and household pests.",
},
加上:
{
    id:"test1",
    title:"测试1",
    date:new Date(2014, 6, 24),
    content:"这是测试1。",
},
(逗号不可少)
root@as3:~/bramble-mvc/examples/catblog/lib/data# cd ../..
root@as3:~/bramble-mvc/examples/catblog# node application.js (这个就是更新静态网站的命令)

演示站点:http://as3.brite.biz:5319/,http://as3.brite.biz:5319/blog,
http://bramble.brite.biz.st
项目地址:https://github.com/iansullivan88/bramble-mvc,
https://github.com/iansullivan88/bramble-mvc/issues/1
可惜源贴中,不支持插入embed代码或object代码或iframe代码,因此无法嵌入音频/视频。
粘贴文字内容的html code时,最好先去掉那些html tag,把所有的文字连在一起,然后在需要分段的文字前面加上<br>,
这样最后才能形成段落。
-----------------------------------
更新:向程序作者反映程序不支持插入embed代码或object代码或iframe代码的问题后,作者修改了程序。使用方法如下。这次,程序支持插入embed代码或object代码或iframe代码。

git clone https://github.com/iansullivan88/bramble-mvc bramble-mvc2
cd bramble-mvc2

root@as3:~/bramble-mvc2# ls
bramble.js  lib         README.md  test.js
examples    LICENSE.md  package.json  test
root@as3:~/bramble-mvc2# npm install
root@as3:~/bramble-mvc2# ls
bramble.js  lib         node_modules  README.md  test.js
examples    LICENSE.md  package.json  test
root@as3:~/bramble-mvc2# cd examples
root@as3:~/bramble-mvc2/examples# ls
catblog
root@as3:~/bramble-mvc2/examples# cd catblog
root@as3:~/bramble-mvc2/examples/catblog# ls
application.js  lib  node_modules  output  package.json  posts
root@as3:~/bramble-mvc2/examples/catblog# cd output
root@as3:~/bramble-mvc2/examples/catblog/output# ls
blog  content  home  img  index.html
(可见~/bramble-mvc2/examples/catblog/output/就是静态网站的根目录。)
root@as3:~/bramble-mvc2/examples/catblog/output# nohup Rwebserver 5320 > /dev/null &
访问http://as3.brite.biz:5320/,http://as3.brite.biz:5320/blog即可看到网站效果。

发贴方法:
root@as3:~/bramble-mvc2/examples/catblog/output# cd ..
root@as3:~/bramble-mvc2/examples/catblog# ls
application.js  lib  output  package.json  posts
root@as3:~/bramble-mvc2/examples/catblog# npm install
root@as3:~/bramble-mvc2/examples/catblog# ls
application.js  lib  node_modules  output  package.json  posts
root@as3:~/bramble-mvc2/examples/catblog# cd posts
root@as3:~/bramble-mvc2/examples/catblog/posts# nano test2.html

按~/bramble-mvc2/examples/catblog/posts/里面的某个html文件的格式,新建帖子test2.html,格式为:
---
title: 测试2
date: 2014-06-25 11:01
---

<p>这是测试2.</p>


然后,
root@as3:~/bramble-mvc2/examples/catblog/posts# cd ..
root@as3:~/bramble-mvc2/examples/catblog# ls
application.js  lib  node_modules  output  package.json  posts
root@as3:~/bramble-mvc2/examples/catblog# node application.js (这个就是更新静态网站的命令)

演示站点:http://as3.brite.biz:5320/,http://as3.brite.biz:5320/blog/
 http://bramble2.brite.biz.st
项目地址:https://github.com/iansullivan88/bramble-mvc,
https://github.com/iansullivan88/bramble-mvc/issues/1