Pages

Thursday, 9 March 2017

搭建基于java的静态博客程序griffin

首先在linux vps上安装java环境。

mkdir griffin-0.2.1
cd griffin-0.2.1
wget https://github.com/pawandubey/griffin/releases/download/v0.2.1/griffin-0.2.1.zip
unzip griffin-0.2.1.zip

root@AR:~/griffin-0.2.1# ls
griffin  griffin-0.2.1.zip
root@AR:~/griffin-0.2.1#  cd griffin
root@AR:~/griffin-0.2.1/griffin# ls
bin  griffin.jar  scaffold.zip
root@AR:~/griffin-0.2.1/griffin# cd bin
root@AR:~/griffin-0.2.1/griffin/bin# ls
cache.db  cache.db.p  griffin  griffin.bat
root@AR:~/griffin-0.2.1/griffin/bin#
(~/griffin-0.2.1/griffin/bin/griffin就是可执行文件)


root@AR:~/griffin-0.2.1/griffin/bin# cd /usr/local
root@AR:/usr/local#
root@AR:/usr/local# griffin new . -name griffin-site  (此命令的意思是在当前目录下,生成griffin-site目录。显示如下,一一回答其问题:                                                        
Heya! This is griffin. Your personal, fast and easy static site generator. (And an overall good guy)
You have chosen to create your new griffin site at: ./griffin-site
I'd love to help you set up some initial settings for your site, so let's go.
I'll ask you a set of simple questions and you can type in your answer. Some questions have a default answer, which will be marked in brackets.
You can just press enter to accept the default value in those cases.

1. What would you like to call your site?(Your Own Griffin):
my griffin blog
2. Who's authoring this site?
brite
3. What will be the tagline for the site?(Not just another site):

4. What will you like to name the folder where your posts will be stored?(content):

5. What will you like to name the folder where the generated site will be stored?(output):

6. What will you like to format the dates on yourData. posts and pages as?(yyyy MM dd):

7. On what port will you like to see the live preview of your site?(9090):

Successfully created new site.

root@AR:/usr/local#
root@AR:/usr/local# cd griffin-site 
root@AR:/usr/local/griffin-site# ls
config.toml  content  output  themes
root@AR:/usr/local/griffin-site# nano config.toml
(我把postsperindex的值改为了3.意思是每页所显示的帖子数;把baseurl的值改为所要绑定的域名地址,我的为http://grf.bright.biz.st)
root@AR:/usr/local/griffin-site# ls output
root@AR:/usr/local/griffin-site#
(现在 output还只是一个空目录)
root@AR:/usr/local/griffin-site# cd content
root@AR:/usr/local/griffin-site/content# nano test-1.md
root@AR:/usr/local/griffin-site/content# cat test-1.md
title= "测试1"
author= "brite"
layout= "post" 
date= "2017 03 08"
tags = ["code","life", "nav"]
slug = "test-1"
#####

这是测试1.

root@AR:/usr/local/griffin-site/content# cd ..
root@AR:/usr/local/griffin-site# ~/griffin-0.2.1/griffin/bin/griffin publish --rebuild (此即生成/更新静态网站的根目录的内容的命令)
root@AR:/usr/local/griffin-site# cd output
root@AR:/usr/local/griffin-site/output# ls
SITEMAP.xml  assets         index.html  qingming  test-1  traveler-song
ask-lsj      becoz-i-love-u  page     send-mhr  test-2  uce
root@AR:/usr/local/griffin-site/output#
(可见 /usr/local/griffin-site/output就是静态网站的根目录)

演示网站:http://grf.bright.biz.st/
项目地址:https://github.com/pawandubey/griffin
https://github.com/pawandubey/griffin/wiki/Writing
https://github.com/pawandubey/griffin/issues/40

这个静态博客程序里,在同一天所发表的帖子不是按时间顺序排列的。
这个静态博客程序不支持插入iframe代码,比如http://grf.bright.biz.st/becoz-i-love-u/;
但是支持插入embed代码,比如http://grf.bright.biz.st/moonriver/

No comments:

Post a Comment