Pages

Thursday, 31 October 2013

在linux vps上搭建基于perl的静态博客程序-templer

$ git clone https://github.com/skx/templer.git
$ cd templer
$ make && make install
$ templer-generate templer-site
# cd templer-site
# templer

as3:~# git clone https://github.com/skx/templer.git
Cloning into templer...
remote: Counting objects: 1487, done.
remote: Compressing objects: 100% (670/670), done.
remote: Total 1487 (delta 735), reused 1452 (delta 702)
Receiving objects: 100% (1487/1487), 492.58 KiB | 608 KiB/s, done.
Resolving deltas: 100% (735/735), done.
as3:~# cd templer
as3:~/templer# ls
build-templer  lib       PLUGINS.md  templer.cfg.sample
debian         LICENSE   README.md   templer-generate.in
examples       Makefile  t           templer.in
as3:~/templer# make
perl build-templer
chmod +x templer
cat templer-generate.in lib/Templer/Site/New.pm > templer-generate
chmod +x templer-generate
as3:~/templer# ls
build-templer  lib       PLUGINS.md  templer             templer-generate.in
debian         LICENSE   README.md   templer.cfg.sample  templer.in
examples       Makefile  t           templer-generate
as3:~/templer# make install
cp ./templer ./templer-generate /usr/local/bin
chown root.root /usr/local/bin/templer /usr/local/bin/templer-generate
chmod 755 /usr/local/bin/templer /usr/local/bin/templer-generate
as3:~/templer# templer-generate templer-site
as3:~/templer# ls
build-templer  lib       PLUGINS.md  templer             templer-generate.in
debian         LICENSE   README.md   templer.cfg.sample  templer.in
examples       Makefile  t           templer-generate    templer-site
as3:~/templer# ls templer-site
includes  input  layouts  output  plugins  templer.cfg
as3:~/templer# cd templer-site
as3:~/templer/templer-site# ls
includes  input  layouts  output  plugins  templer.cfg
as3:~/templer/templer-site# ls output
as3:~/templer/templer-site# templer
All done: 2 page(s) updated in less than 1 second.
as3:~/templer/templer-site# ls
includes  input  layouts  output  plugins  templer.cfg
as3:~/templer/templer-site# ls output
about.html  index.html  robots.txt 
as3:~/templer/templer-site# cd output
as3:~/templer/templer-site/output# ls
about.html  index.html  robots.txt
(运行templer后,output目录由空目录变成包含了这些内容,而且有index.html,可见~/templer/templer-site/output/就是静态网站的根目录。)
as3:~/templer/templer-site/output# Rwebserver 5436 > /dev/null &

demo site: http://as3.brite.biz:5436/
http://as3.brite.biz:5436/about.html
http://as3.brite.biz:5436/test1.html
http://as3.brite.biz:5436/test2.html

发贴方法:
as3:~/templer/templer-site# cd input
as3:~/templer/templer-site/input# ls
about.wgn  index.wgn  robots.txt
按about.wgn的格式,新建帖子test1.wgn,格式如下:
title: test1
----
这是测试1.
as3:~/templer/templer-site/input# cd ..
as3:~/templer/templer-site# templer (这个就是生成/更新静态网站的命令)

项目地址:https://github.com/skx/templer