Total Pageviews

Saturday 28 June 2014

在linux vps上搭建基于stasis的静态博客程序:blog-gen和augustl

git clone https://github.com/gilbertw1/blog-gen blog-gen-site
cd blog-gen-site

root@as3:~/blog-gen-site# ls
project.clj  README.md  resources  src  test
root@as3:~/blog-gen-site# lein build-site (这个就是生成/更新静态网站的根目录的命令)
root@as3:~/blog-gen-site# ls
dist  project.clj  README.md  resources  src  target  test
(新出现了dist目录和target目录)
root@as3:~/blog-gen-site# cd dist
root@as3:~/blog-gen-site/dist# ls
01c3be5bd3b1    archive                 dc22c5a50c24         misc2-atom.xml
0f215576fa3c    atom.xml                f780eae56b8c         misc3-atom.xml
2f303a09b7af    blog                    fd64f70a4242         play2-atom.xml
3cfdb5bc6ad2    c731172af9aa            images               resume.html
54424dece1ba    clojure-atom.xml        index.html           rxjava-atom.xml
684c38ecc30f    clojurescript-atom.xml  iteratees-atom.xml   scala-atom.xml
72777fb205ae    code                    javascript-atom.xml  tags
7f4aef274857    core.async-atom.xml     macros-atom.xml      tutorial-atom.xml
anorm-atom.xml  css                     misc1-atom.xml
(里面有index.html,可见~/blog-gen-site/dist/就是静态网站的根目录)
root@as3:~/blog-gen-site/dist# nohup Rwebserver 32153 > /dev/null &
访问http://as3.brite.biz:32153/即可看到网站效果。

发贴方法:
root@as3:~/blog-gen-site/dist# cd ../resources/posts
root@as3:~/blog-gen-site/resources/posts# ls
2013-07-01-anorm-pk-json.md
2013-07-05-action-composition-auth.md
2013-07-19-escaping-callback-hell-with-core-async.md
2013-07-30-anatomy-of-a-clojure-macro.md
2013-10-22-rxPlay-making-iteratees-and-observables-play-nice.md
2013-11-03-rx-the-importance-of-honoring-unsubscribe.md
root@as3:~/blog-gen-site/resources/posts# nano 2014-06-28-this-is-test1.md
按里面某个md文件的格式,新建帖子2014-06-28-this-is-test1.md,格式为:
---
title : 测试1
tags : [misc1, misc2, misc3]
---

这是测试1.


然后,
root@as3:~/blog-gen-site/resources/posts# cd ../..
root@as3:~/blog-gen-site# lein build-site

演示站点:http://as3.brite.biz:32153/,http://blog-gen.brite.biz.st/
项目地址:https://github.com/gilbertw1/blog-gen
https://github.com/magnars/stasis

 注意:新建帖子时,文件名最好命名为2014-07-07-1810-jingle-bell.md,
 2014-07-07-1828-black-dot-on-white-paper.md这样的形式,这样所发表的帖子就是按时间顺序排列的了
------------------
类似的源码

git clone https://github.com/augustl/augustl.com augustl.com-site
cd augustl.com-site

root@as3:~/augustl.com-site# ls
deploy.sh   posts  project.clj  README  resources  src 
root@as3:~/augustl.com-site# lein export (这个就是生成/更新静态网站的根目录的命令)
root@as3:~/augustl.com-site# ls
deploy.sh  dist  posts  project.clj  README  resources  src  target
(生成了dist目录)
root@as3:~/augustl.com-site# cd dist
root@as3:~/augustl.com-site/dist# ls
02d2ad4edc12  9516652d3f2b  about     blog          fe4800707436  stylesheets
275476795ca3  9a19b1b112de  archive   dump          index.html
28c59dd5d58c  a051501decb0  atom.xml  fdd30613eedd  static
(可见~/augustl.com-site/dist/就是静态网站的根目录)
root@as3:~/augustl.com-site/dist# nohup Rwebserver 32154 > /dev/null &
访问http://as3.brite.biz:32154/即可看到网站效果。

发贴方法:
root@as3:~/augustl.com-site/dist# cd ../posts/blog/2014/
root@as3:~/augustl.com-site/posts/blog/2014# nano super_talk.html
格式为:
date: 2014.06.28
title: 高论

不花钱与女人发生关系,是一夜情。。。


然后,
root@as3:~/augustl.com-site/posts/blog/2014# cd ~/augustl.com-site
root@as3:~/augustl.com-site# lein export

演示站点:http://as3.brite.biz:32154/,http://augustl.brite.biz.st/
项目地址:https://github.com/augustl/augustl.com
https://github.com/magnars/stasis

相关帖子:http://briteming.blogspot.co.uk/2014/06/building-static-sites-in-clojure-with.html

stasis是基于java和lein的博客程序。lein的安装见这里:
http://briteming.blogspot.co.uk/2014/03/linux-vpsjavaclojure-nakkaya-static.html