Total Pageviews

Friday, 26 August 2016

搭建基于nodejs的静态博客程序fow

npm install -g fow@0.0.5-3

cd /usr/local
root@AR:/usr/local# fow init fow-site
(此命令会在当前目录下,生成fow-site目录)
root@AR:/usr/local# cd fow-site
root@AR:/usr/local/fow-site# ls
config.yml  drafts  favicon.ico  layouts  plugins  themes 
root@AR:/usr/local/fow-site# fow new misc/绝色神偷 (此时,生成的源贴还只是空文件)
root@AR:/usr/local/fow-site# fow build (此即生成/更新静态网站的命令)
[2016-08-26 09:47:00.064] [INFO] [default] - Building index
[2016-08-26 09:47:00.187] [INFO] [default] - Building archive
[2016-08-26 09:47:00.254] [INFO] [default] - Building category
[2016-08-26 09:47:00.279] [INFO] [default] - Building tag
[2016-08-26 09:47:00.304] [INFO] [default] - Building article
[2016-08-26 09:47:00.305] [INFO] [default] - Building custom
[2016-08-26 09:47:00.310] [INFO] [default] - Building /usr/local/fow-site/drafts/categories/misc/绝色神偷.md
root@AR:/usr/local/fow-site# nano /usr/local/fow-site/drafts/categories/misc/绝色神偷.md
root@AR:/usr/local/fow-site# cat /usr/local/fow-site/drafts/categories/misc/绝色神偷.md
<iframe width="640" height="360" src="https://www.youtube.com/embed/NQ5hofOsntE" frameborder="0" allowfullscreen></iframe>
(如果是纯代码,直接写入代码。无需header部分.如果是文字内容,则在需要截断的地方插入<!--more-->即可,也无需header部分)
root@AR:/usr/local/fow-site# fow build 
root@AR:/usr/local/fow-site# ls
archive.html  category.html  drafts   index.html  plugins themes
categories    config.yml     favicon.ico  layouts     tag.html
root@AR:/usr/local/fow-site# 
(/usr/local/fow-site/里生成了index.html文件,可见/usr/local/fow-site/就是静态网站的根目录)

演示网站:http://fow.smt.biz.st
项目地址:https://github.com/zhangxiaoyang/fow/
https://github.com/zhangxiaoyang/fow/issues/1