Pages

Wednesday, 13 November 2013

在linux vps下,搭建基于go的静态博客程序hastie

~/mygo# go get github.com/mkaz/hastie
~/mygo# go install ./src/github.com/mkaz/hastie/
root@default:~/mygo# cd src/github.com/mkaz/hastie/
root@default:~/mygo/src/github.com/mkaz/hastie# cd test
root@default:~/mygo/src/github.com/mkaz/hastie/test# ls
hastie.json  layouts  posts
root@default:~/mygo/src/github.com/mkaz/hastie/test# ls posts
2011-03-02-giraffe.md  index.md  rss.md  style.less  zebra
root@default:~/mygo/src/github.com/mkaz/hastie/test#  cp -r ~/npm/lib/node_modules/less /usr/local/lib/node_modules/
root@default:~/mygo/src/github.com/mkaz/hastie/test# hastie -c=hastie.json -m=true
(hastie -c=hastie.json -m=true就是生成/更新静态网站的命令.)
root@default:~/mygo/src/github.com/mkaz/hastie/test# ls
hastie.json  layouts  posts public (新出现了public目录)
root@default:~/mygo/src/github.com/mkaz/hastie/test# cd public

root@as3:~/mygo/src/github.com/mkaz/hastie/test/public# ls
giraffe.html  index.html  rss.xml  style.css  zebra
(可见~/mygo/src/github.com/mkaz/hastie/test/public/就是静态网站的根目录)
root@as3:~/mygo/src/github.com/mkaz/hastie/test/public#

发贴方法:
root@as3:~/mygo/src/github.com/mkaz/hastie/test/public# cd ../posts/
root@as3:~/mygo/src/github.com/mkaz/hastie/test/posts# ls
2011-03-02-giraffe.md  index.md  rss.md  style.less  zebra
root@as3:~/mygo/src/github.com/mkaz/hastie/test/posts# cd zebra
root@as3:~/mygo/src/github.com/mkaz/hastie/test/posts/zebra# ls
2009-12-12-zebras.md  2012-02-14-hastie-intro.md index.md
root@as3:~/mygo/src/github.com/mkaz/hastie/test/posts/zebra# nano  index.md
( 在此行:# Welcome to the Test Site for Hastie的上一行加上
<p><a href=/zebra>请访问博客</a></p>)
root@as3:~/mygo/src/github.com/mkaz/hastie/test/posts/zebra# nano 2013-11-14-test1.md
(按2012-02-14-hastie-intro.md的格式,新建帖子2013-11-14-test1.md,格式如下:
---
title: test1
layout: post
---


this is test1.

保存更改。然后:
root@as3:~/mygo/src/github.com/mkaz/hastie/test/posts/zebra# cd ../../
root@as3:~/mygo/src/github.com/mkaz/hastie/test# hastie -c=hastie.json -m=true
(hastie -c=hastie.json -m=true是生成/更新静态网站的命令.)

演示站点:
http://ht-as.brite.biz,
项目地址:http://github.com/mkaz/hastie