Total Pageviews

Saturday 14 June 2014

在linux vps上搭建基于java/groovy的静态博客程序-grain

git clone https://github.com/sysgears/grain-theme-octopress
cd grain-theme-octopress

as3:~/grain-theme-octopress# ls
application.properties  gradle       grainw      README.md         
build.gradle            gradlew      grainw.bat  SiteConfig.groovy
content                 gradlew.bat  LICENSE     theme
as3:~/grain-theme-octopress# ./grainw (启动预览服务器)
访问http://as3.brite.biz:4000/即可看到网站效果。
按crtl+c退出预览服务器。
as3:~/grain-theme-octopress# ./gradlew gendeps
as3:~/grain-theme-octopress# ./grainw generate (这个就是生成/更新静态网站的命令),运行此命令后,在当前目录下,会生成target目录。
as3:~/grain-theme-octopress# ls
application.properties  gradle       grainw      README.md          theme
build.gradle            gradlew      grainw.bat  SiteConfig.groovy
content                 gradlew.bat  LICENSE     target
(新出现了target目录)
as3:~/grain-theme-octopress# cd target
as3:~/grain-theme-octopress/target# ls
archives  atom.xml  blog        config.rb  index.html   page        stylesheets
assets    authors   categories  images     javascripts  robots.txt
(可见~/grain-theme-octopress/target/就是静态网站的根目录。)
as3:~/grain-theme-octopress/target# nohup Rwebserver 54923 > /dev/null &
访问http://as3.brite.biz:54923/即可看到网站效果。

发贴方法:
as3:~/grain-theme-octopress/target# cd ../content/blog
as3:~/grain-theme-octopress/content/blog# ls
2014-01-08-blockquote-tag.markdown  2014-01-09-video-tag.markdown
2014-01-08-pullquote-tag.markdown   2014-01-10-gist-tag.markdown
2014-01-08-raw-tag.markdown         2014-01-10-jsfiddle-tag.markdown
2014-01-09-image-tag.markdown       2014-01-10-post-sample-with-code.markdown
as3:~/grain-theme-octopress/content/blog# nano 2014-06-14-test2.markdown
按2014-01-10-post-sample-with-code.markdown的格式,新建帖子2014-06-14-test2.markdown,格式为:
---
layout: post
title: "test2" (建议不要用中文标题)
date: "2014-06-14 13:36"
author: ym
categories: [misc1, misc2]
comments: true                   
published: true                              
---

## 测试2 (这个变相起到中文标题的作用)
<!--more-->
这是测试2.



然后,
as3:~/grain-theme-octopress/content/blog# cd ../..
as3:~/grain-theme-octopress# ./grainw generate
as3:~/grain-theme-octopress# nano SiteConfig.groovy
(编辑配置文件SiteConfig.groovy,可以修改博客的标题,每页所显示的帖子数)
as3:~/grain-theme-octopress# ./grainw generate

演示站点:http://as3.brite.biz:5498/,http://grain.brite.biz.st
不支持发表180KB的长文。
项目地址:http://sysgears.com/grain/docs/latest/#getting-started
https://github.com/sysgears/grain-theme-octopress
https://github.com/sysgears/grain (似乎用不着此源码)