Pages

Tuesday, 19 July 2016

基于clojure的静态博客程序-cryogen

首先在linux vps中安装jdk/java,然后
wget https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein
mv lein /usr/local/bin/
chmod 755 /usr/local/bin/lein

lein new cryogen cryogen-blog
(此命令会在当前目录下生成cryogen-blog目录) 
cd cryogen-blog
lein ring server 
(这个就是生成静态博客的命令)
 
root@AR:~# mv cryogen-blog /usr/local/
root@AR:~# cd /usr/local/cryogen-blog
root@AR:/usr/local/cryogen-blog# ls
project.clj  resources src  target
root@AR:/usr/local/cryogen-blog# cd resources
root@AR:/usr/local/cryogen-blog/resources# ls
public templates
root@AR:/usr/local/cryogen-blog/resources# cd public
root@AR:/usr/local/cryogen-blog/resources/public# ls
404.html css     js    posts-output
archives feed.xml    pages   sitemap.xml
authors-output img     pages-output  tags
cryogen.xml index.html  posts   tags-output
(/usr/local/cryogen-blog/resources/public/目录里有index.html文件,可见
 /usr/local/cryogen-blog/resources/public/就是静态博客的根目录)
root@AR:/usr/local/cryogen-blog/resources/public# cd ..
root@AR:/usr/local/cryogen-blog/resources# cd templates
root@AR:/usr/local/cryogen-blog/resources/templates# ls
asc  config.edn  img  md  themes
root@AR:/usr/local/cryogen-blog/resources/templates# nano config.edn
(把blog-prefix的值改为"/")
root@AR:/usr/local/cryogen-blog/resources/templates# cd md
root@AR:/usr/local/cryogen-blog/resources/templates/md# ls
pages  posts
root@AR:/usr/local/cryogen-blog/resources/templates/md# cd posts
root@AR:/usr/local/cryogen-blog/resources/templates/md/posts# ls
2014-03-10-first-post.md   2016-01-07-docs.md
2014-11-04-second-post.md  
root@AR:/usr/local/cryogen-blog/resources/templates/md/posts# nano 2016-07-19-test-1.md
(2016-07-19-test-1.md的内容如下:
{:title "测试1"
 :layout :post
 :tags  ["testing, misc"]}

这是测试1.看看如何呢?)
root@AR:/usr/local/cryogen-blog/resources/templates/md/posts# cd 
~/cryogen-blog
root@AR:/usr/local/cryogen-blog# lein ring server
 
演示站点:http://surmount.biz.st:3454/,http://crg.smt.biz.st/
项目地址:https://github.com/cryogen-project/cryogen
http://cryogenweb.org/