Total Pageviews

Wednesday, 11 June 2014

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

git clone https://github.com/agrison/jssg jssg-site
cd jssg-site

as3:~/jssg-site# ls
jssg  jssg.iml  jssg.sh  libs  pom.xml  README.md  src 
as3:~/jssg-site# mvn package
as3:~/jssg-site# ls
jssg  jssg.iml  jssg.sh  libs  pom.xml  README.md  src  target
(新出现了target目录)
as3:~/jssg-site# cd target
as3:~/jssg-site/target# ls
classes                                  maven-archiver
com.googlecode.addjars.mojo.AddJarsMojo  original-jssg-1.0.0-SNAPSHOT.jar
dependency-reduced-pom.xml               surefire-reports
jssg-1.0.0-SNAPSHOT.jar                  test-classes
as3:~/jssg-site/target# cd ..
as3:~/jssg-site# mkdir jssgblog
as3:~/jssg-site# cd jssgblog
as3:~/jssg-site/jssgblog# java -jar ~/jssg-site/target/jssg-1.0.0-SNAPSHOT.jar -init
(此命令的作用是在当前目录里,初始化/生成博客目录结构)
as3:~/jssg-site/jssgblog# ls
config.properties  index.textile  _layout  _posts
as3:~/jssg-site/jssgblog# java -jar ~/jssg-site/target/jssg-1.0.0-SNAPSHOT.jar -build
(这个就是生成/更新静态网站的命令)
as3:~/jssg-site/jssgblog# ls
_build  config.properties  index.textile  _layout  _posts
(新出现了_build目录)
as3:~/jssg-site/jssgblog# cd _build
as3:~/jssg-site/jssgblog/_build# ls
2014 config.properties  index.html
(可见~/jssg-site/jssgblog/_build/就是静态网站的根目录)
as3:~/jssg-site/jssgblog/_build# nohup Rwebserver 39826 > /dev/null &
 访问http://as3.brite.biz:39826/ 即可看到网站效果。

发贴方法:
as3:~/jssg-site/jssgblog/_build# cd ..
as3:~/jssg-site/jssgblog# ls
_build  config.properties  index.textile  _layout  _posts
as3:~/jssg-site/jssgblog# cd _posts
as3:~/jssg-site/jssgblog/_posts# mv */*/*/* . && rm -rf 2014
as3:~/jssg-site/jssgblog/_posts# ls
2014-06-08-Hello.mkd
as3:~/jssg-site/jssgblog/_posts# nano 2014-06-12-test1.mkd
按2014-06-08-Hello.mkd的格式,新建帖子2014-06-12-test1.mkd,格式为:
---
title: 测试1
layout: blog
description:
date: 2014-06-12
comments: true
url: 2014/06/12/test1
---

## 测试1

这是测试1.


然后,
as3:~/jssg-site/jssgblog/_posts# cd ..
as3:~/jssg-site/jssgblog# java -jar ~/jssg-site/target/jssg-1.0.0-SNAPSHOT.jar -build

演示站点:http://as3.brite.biz:39826/,http://jssg.brite.biz.st
(网站的中文有乱码,把ff浏览器的编码设为unicode即可。)
项目地址:https://github.com/agrison/jssg
https://github.com/agrison/jssg/issues/2