git clone https://github.com/jaredhanson/kerouac
cd kerouac
npm install kerouac或npm install (这2个命令是等效的,运行其中之一后,就不能运行另一个了)
as3:~/kerouac# ls
bin lib LICENSE Makefile node_modules package.json README.md test
as3:~/kerouac# git clone https://github.com/jaredhanson/www.locomotivejs.org www.locomotivejs.org-site
as3:~/kerouac# cd www.locomotivejs.org-site
as3:~/kerouac/www.locomotivejs.org-site# ls
content public server.js site.js
layouts Makefile package.json README.md
as3:~/kerouac/www.locomotivejs.org-site# npm install
as3:~/kerouac/www.locomotivejs.org-site# make site (这个就是生成/更新静态网站的命令)
as3:~/kerouac/www.locomotivejs.org-site# ls
content locomotivejs.org node_modules public server.js
layouts Makefile package.json README.md site.js
(新出现了node_modules目录-这是由npm install带来的;新出现了locomotivejs.org目录,这是由make site
生成的。)
as3:~/kerouac/www.locomotivejs.org-site# cd locomotivejs.org
as3:~/kerouac/www.locomotivejs.org-site/locomotivejs.org# ls
assets guide index.html robots.txt sitemap.xml vendor
as3:~/kerouac/www.locomotivejs.org-site/locomotivejs.org#
可见~/kerouac/www.locomotivejs.org-site/locomotivejs.org/就是静态网站的根目录。
as3:~/kerouac/www.locomotivejs.org-site/locomotivejs.org# nohup Rwebserver 34271 > /dev/null &
访问http://as3.brite.biz:34271/就可看到网站效果。
发贴方法:
as3:~/kerouac/www.locomotivejs.org-site/locomotivejs.org# cd ..
as3:~/kerouac/www.locomotivejs.org-site# ls
content locomotivejs.org node_modules public server.js
layouts Makefile package.json README.md site.js
as3:~/kerouac/www.locomotivejs.org-site# cd content
as3:~/kerouac/www.locomotivejs.org-site/content# ls
guide index.html
as3:~/kerouac/www.locomotivejs.org-site/content# cd guide
as3:~/kerouac/www.locomotivejs.org-site/content/guide# ls
application.md directory-structure.md index.md resources.md
architecture.md filters.md initialization.md routing.md
controllers.md formats.md mongoose.md verbs.md
datastores.md get-started.md namespaces.md views.md
as3:~/kerouac/www.locomotivejs.org-site/content/guide# nano test1.md
按index.md的格式,新建帖子test1.md,格式如下:
---
layout: guide
title: test1
---
### test1
这是测试1.
然后,
as3:~/kerouac/www.locomotivejs.org-site/content/guide# cd ~/kerouac/www.locomotivejs.org-site/
as3:~/kerouac/www.locomotivejs.org-site# make site
演示站点:
http://as3.brite.biz:34271/,http://kra.brite.biz.st
http://as3.brite.biz:34271/guide/
http://as3.brite.biz:34271/guide/test1/
http://as3.brite.biz:34271/guide/test2/
项目地址:https://github.com/jaredhanson/kerouac,
https://github.com/jaredhanson/www.locomotivejs.org
不过已发表的文章并不显示在首页http://as3.brite.biz:34271/guide/,可通过修改
~/kerouac/www.locomotivejs.org-site/layouts/guide/toc.ejs文件来实现目的,在
<li><a href="/guide/">Overview</a></li>的上一行加上:
<li><a href="/guide/chinese-economy/">中国经济</a></li>
<li><a href="/guide/smiling-face/">笑脸</a></li>
<li><a href="/guide/test2/">测试2</a></li>
<li><a href="/guide/test1/">测试1</a></li>
as3:~/kerouac/www.locomotivejs.org-site# nano ~/kerouac/www.locomotivejs.org-site/layouts/guide/toc.ejs
as3:~/kerouac/www.locomotivejs.org-site# make site