Total Pageviews

Friday, 6 January 2017

搭建基于haskell的静态博客程序gwenbell

先按此文http://briteming.blogspot.jp/2016/07/hakyll.html,安装stack和ghc.

cd /usr/local
git clone https://gitlab.com/tubaman/gwenbell gwenbell.com
cd gwenbell.com
 
root@AR:/usr/local/gwenbell.com# ls
images      posts    templates
index.html  site.hs  static
root@AR:/usr/local/gwenbell.com# ghc --make site.hs
root@AR:/usr/local/gwenbell.com# ls
images      posts  site.hi  site.o  templates
index.html  site   site.hs  static
(生成了可执行文件site)
root@AR:/usr/local/gwenbell.com# ./site build (这个就是生成、更新静态网站的根目录的命令)
root@AR:/usr/local/gwenbell.com# ls
_cache  images      posts  site.hi  site.o  templates
_site   index.html  site   site.hs  static
root@AR:/usr/local/gwenbell.com# cd _site
root@AR:/usr/local/gwenbell.com/_site# ls
approach         deliberate  regenerate  tmux
archive          gitlab      static
images      index.html 
root@AR:/usr/local/gwenbell.com/_site#
(可见/usr/local/gwenbell.com/_site就是静态网站的根目录)

新建源帖:
root@AR:/usr/local/gwenbell.com/_site# cd ..
root@AR:/usr/local/gwenbell.com# cd posts
root@AR:/usr/local/gwenbell.com/posts# nano 2016-01-06-test-1.md
root@AR:/usr/local/gwenbell.com/posts# cat 2016-01-06-test-1.md
---
title: 测试1
date: 2017-01-06
---

这是测试1.

看看如何?

root@AR:/usr/local/gwenbell.com/posts# cd ..
root@AR:/usr/local/gwenbell.com# ./site build
( root@AR:/usr/local/gwenbell.com/_site# ls
2016-01-06-test-1            approach         deliberate  regenerate  tmux
2016-01-06-test-2            archive          gitlab      static
2016-01-06-uchinese-economy      images    
2016-01-06-vbcoz-i-love-u     index.html
root@AR:/usr/local/gwenbell.com/_site#)

演示网站: http://gb.bright.biz.st/
项目地址:https://gitlab.com/tubaman/gwenbell

类似的:
cd /usr/local
git clone https://gitlab.com/gwenbell/gwenbell-hakyll gwenbell.com-2
cd  gwenbell.com-2

root@AR:/usr/local/gwenbell.com-2# ls
README.md  posts  templates
images  site.hs  static
root@AR:/usr/local/gwenbell.com-2# ghc --make site.hs
root@AR:/usr/local/gwenbell.com-2# ls
README.md posts  site.hi  site.o  templates
 images  site   site.hs  static
root@AR:/usr/local/gwenbell.com-2# ./site build
(如果遇错,则把帖子的title的值加上英文单引号或双引号)
root@AR:/usr/local/gwenbell.com-2# ls
README.md  _site   posts  site.hi  site.o  templates
_cache       images  site   site.hs  static
root@AR:/usr/local/gwenbell.com-2# cd _site
root@AR:/usr/local/gwenbell.com-2/_site#
( /usr/local/gwenbell.com-2/_site目录里含有index.html,可见/usr/local/gwenbell.com-2/_site就是静态网站的根目录)

新建源帖:
root@AR:/usr/local/gwenbell.com-2/_site# cd ../posts
root@AR:/usr/local/gwenbell.com-2/posts#
root@AR:/usr/local/gwenbell.com-2/posts# nano 2017-01-07-test-1.md
root@AR:/usr/local/gwenbell.com-2/posts# cat 2017-01-07-test-1.md
---
title: 测试1
date: 2017-01-07
---

这是测试1.

看看如何?

root@AR:/usr/local/gwenbell.com-2/posts# cd ..
root@AR:/usr/local/gwenbell.com-2# ./site build
root@AR:/usr/local/gwenbell.com-2# cd _site
root@AR:/usr/local/gwenbell.com-2/_site# rm index.html
root@AR:/usr/local/gwenbell.com-2/_site# nano index.html
root@AR:/usr/local/gwenbell.com-2/_site# cat index.html
<meta http-equiv=refresh content="0;url=/archive/">
root@AR:/usr/local/gwenbell.com-2/_site#

演示网站:http://gb2.bright.biz.st/
项目地址:https://gitlab.com/gwenbell/gwenbell-hakyll

类似的项目地址:https://gitlab.com/ev/evbogue/tree/gb,
cd /usr/local
git clone --branch gb https://gitlab.com/ev/evbogue evbogue-site-gb-branch
cd evbogue-site-gb-branch
ghc --make site.hs
./site build
演示网站: http://evb.bright.biz.st/
项目地址:https://gitlab.com/ev/evbogue/tree/gb