JBake 为开发者提供一个基于 Java 的开源静态网站/博客生成器。
特点:
项目地址: https://github.com/jonbullock/JBake
示例: http://as3.brite.biz:5500/,http://jbake.brite.biz/
-------------------------------------------
在linux vps上搭建基于Java的静态网站/博客生成器:JBake
#git clone https://github.com/jonbullock/JBake.git
#cd JBake
#mvn package
as3:~/JBake2# cd src/main/templates
as3:~/JBake2/src/main/templates#
as3:~/JBake2/src/main/templates# ls
base.zip
as3:~/JBake2/src/main/templates# unzip base.zip
as3:~/JBake2/src/main/templates# mv ~/JBake2/src/main/templates/* ~/JBake2/
as3:~/JBake2/src/main/templates# cd ~/JBake2/
as3:~/JBake2# ls
assets dist LICENSE README.md src templates
content jbake.properties pom.xml ROADMAP.txt target
as3:~/JBake2# chmod 755 ~/JBake2/src/main/scripts/jbake
as3:~/JBake2# export PATH=$PATH:/root/JBake2/src/main/scripts/
as3:~/JBake2# ln -s /root/JBake2/src/main/scripts/jbake /usr/sbin/jbake
(然后把export PATH=$PATH:/root/JBake2/src/main/scripts/添加到/etc/profile文件的末尾)
as3:~/JBake2# jbake (该命令即是生成静态网站的命令,在当前目录下会生成output目录,这个output目录-~/JBake2/output就是静态网站的根目录。你可绑定域名到该目录)
as3:~/JBake2# ls
assets dist LICENSE pom.xml ROADMAP.txt target
content jbake.properties output README.md src templates
as3:~/JBake2# cd output
as3:~/JBake2/output# ls
about.html archive.html blog css feed.xml img index.html js
as3:~/JBake2/output# cd ..
as3:~/JBake2# cd content
as3:~/JBake2/content# ls
about.html blog
as3:~/JBake2/content# cd blog
as3:~/JBake2/content/blog# ls
2013
as3:~/JBake2/content/blog# cd 2013
as3:~/JBake2/content/blog/2013# ls
first-post.html second-post.md third-post.ad
as3:~/JBake2/content/blog/2013#
发贴方法:
在~/JBake2/content/blog/2013/里,新建帖子test1.html(按里面的first-post.html的格式:
title=标题名称
date=2013-07-24
type=post
status=published
~~~~~~
此处写正文 )
新建帖子后,保存更改。然后就是更新网站了:
as3:~/JBake2/content/blog/2013# cd ~/JBake2/
as3:~/JBake2# jbake (该命令即是生成静态网站的命令)
示例: http://as3.brite.biz:5501
输出文章摘要的方法:
特点:
- 支持 HTML 和 Markdown 内容
- 允许你认为合适的任何方式组织你的内容,
- Blog aware (RSS feed, tags, archive)
- 可自定义的模板
- 通过Freemarker支持在模板中写脚本
- 支持自定义元数据,暴露在模板
- 功能可配置
- 可以将网站存储至Dropbox, CVS, SVN, Git等。
项目地址: https://github.com/jonbullock/JBake
示例: http://as3.brite.biz:5500/,http://jbake.brite.biz/
-------------------------------------------
在linux vps上搭建基于Java的静态网站/博客生成器:JBake
#git clone https://github.com/jonbullock/JBake.git
#cd JBake
#mvn package
as3:~/JBake2# cd src/main/templates
as3:~/JBake2/src/main/templates#
as3:~/JBake2/src/main/templates# ls
base.zip
as3:~/JBake2/src/main/templates# unzip base.zip
as3:~/JBake2/src/main/templates# mv ~/JBake2/src/main/templates/* ~/JBake2/
as3:~/JBake2/src/main/templates# cd ~/JBake2/
as3:~/JBake2# ls
assets dist LICENSE README.md src templates
content jbake.properties pom.xml ROADMAP.txt target
as3:~/JBake2# chmod 755 ~/JBake2/src/main/scripts/jbake
as3:~/JBake2# export PATH=$PATH:/root/JBake2/src/main/scripts/
as3:~/JBake2# ln -s /root/JBake2/src/main/scripts/jbake /usr/sbin/jbake
(然后把export PATH=$PATH:/root/JBake2/src/main/scripts/添加到/etc/profile文件的末尾)
as3:~/JBake2# jbake (该命令即是生成静态网站的命令,在当前目录下会生成output目录,这个output目录-~/JBake2/output就是静态网站的根目录。你可绑定域名到该目录)
as3:~/JBake2# ls
assets dist LICENSE pom.xml ROADMAP.txt target
content jbake.properties output README.md src templates
as3:~/JBake2# cd output
as3:~/JBake2/output# ls
about.html archive.html blog css feed.xml img index.html js
as3:~/JBake2/output# cd ..
as3:~/JBake2# cd content
as3:~/JBake2/content# ls
about.html blog
as3:~/JBake2/content# cd blog
as3:~/JBake2/content/blog# ls
2013
as3:~/JBake2/content/blog# cd 2013
as3:~/JBake2/content/blog/2013# ls
first-post.html second-post.md third-post.ad
as3:~/JBake2/content/blog/2013#
发贴方法:
在~/JBake2/content/blog/2013/里,新建帖子test1.html(按里面的first-post.html的格式:
title=标题名称
date=2013-07-24
type=post
status=published
~~~~~~
此处写正文 )
新建帖子后,保存更改。然后就是更新网站了:
as3:~/JBake2/content/blog/2013# cd ~/JBake2/
as3:~/JBake2# jbake (该命令即是生成静态网站的命令)
示例: http://as3.brite.biz:5501
输出文章摘要的方法:
And then output this on a page listing posts in a loop:
Or on a page listing posts in a loop you can only show X number of characters from the post itself as a excerpt:
In either case you can add a link to read the whole post just after the excerpt output.