Total Pageviews

Friday, 12 August 2016

安装基于haskell的静态博客程序haggis

首先按“安装haskell(ghc)环境”,安装ghc/cabal.


cabal update
cabal install happy alex
cabal install haggis (如果这步不成功,就按如下做法):
cd /usr/local/
git clone https://github.com/tych0/haggis haggis-site
cd haggis-site

root@AR:/usr/local/haggis-site# ls
dist  haggis.cabal  LICENSE  README.md Setup.hs  src  tools  

root@AR:/usr/local/haggis-site# cabal install
root@AR:/usr/local/haggis-site# git clone https://github.com/tych0/tycho.ws tycho.ws-site
root@AR:/usr/local/haggis-site# cd tycho.ws-site
root@AR:/usr/local/haggis-site/tycho.ws-site# ls
blog.db  haggis.conf  LICENSE  Makefile README.md  src  templates
root@AR:/usr/local/haggis-site/tycho.ws-site# haggis --input . --output output (这个就是生成/更新静态网站的命令。会在当前目录下生成output目录)
root@AR:/usr/local/haggis-site/tycho.ws-site# ls
blog.db  haggis.conf  LICENSE  Makefile  output  README.md  src  templates
root@AR:/usr/local/haggis-site/tycho.ws-site# cd output
root@AR:/usr/local/haggis-site/tycho.ws-site/output# ls
archives       custom.css     img music.html  rss.xml
blog       datamaps.world.min.js     index.html pages     tags
bootstrap.css  googlecba9b12b9c54a0f1.html  map.html post.js     useful.html
comments.php   images     misc.html robots.txt
root@AR:/usr/local/haggis-site/tycho.ws-site/output#
(/usr/local/haggis-site/tycho.ws-site/output/里面有index.html,可见/usr/local/haggis-site/tycho.ws-site/output/就是静态网站的根目录)

新建源贴:
root@AR:/usr/local/haggis-site/tycho.ws-site/output# cd ..
root@AR:/usr/local/haggis-site/tycho.ws-site# ls
blog.db  haggis.conf  LICENSE  Makefile  output  README.md  src  templates
root@AR:/usr/local/haggis-site/tycho.ws-site# cd src
root@AR:/usr/local/haggis-site/tycho.ws-site/src# ls
blog       custom.css     images    misc.md post.js
bootstrap.css  datamaps.world.min.js     img       music.md robots.txt
comments.php   googlecba9b12b9c54a0f1.html  map.html  pages useful.md
root@AR:/usr/local/haggis-site/tycho.ws-site/src# cd blog
root@AR:/usr/local/haggis-site/tycho.ws-site/src/blog# ls
2010  2011  2012  2013 2014  2015  2016
root@AR:/usr/local/haggis-site/tycho.ws-site/src/blog# cd 2016
root@AR:/usr/local/haggis-site/tycho.ws-site/src/blog/2016# ls
01  02 04  
root@AR:/usr/local/haggis-site/tycho.ws-site/src/blog/2016# mkdir 08
root@AR:/usr/local/haggis-site/tycho.ws-site/src/blog/2016# cd 08
root@AR:/usr/local/haggis-site/tycho.ws-site/src/blog/2016/08# nano test-one.md
(按/usr/local/haggis-site/tycho.ws-site/src/blog/2016/04/目录里的lxdbr0.md文件的内容格式,新建源贴test-one.md,内容如下:
---
title: 测试1
date: 2016-08-13
tags: misc1, misc2, misc3
---

这是测试1.看看如何呢? 

同一天里发表的帖子是按帖子所在目录的排列顺序发表的,排列顺序为从a至z排列,越是排列在前面的字母,其对应的帖子就越是展示在页面的上方。比如我先发表test-one.md后,再发表test-two.md。因为我想源帖test-two.md发表后,它展示在源贴test-one.md所对应的帖子的上方,我就需要把test-two.md更名为test-ntwo.md. 字母n排在字母o的前面。)
root@AR:/usr/local/haggis-site/tycho.ws-site/src/blog/2016/08# ls
aclose-and-far.md  chinese-economy.md  test-one.md
air-disaster.md    test-ntwo.md
root@AR:/usr/local/haggis-site/tycho.ws-site/src/blog/2016/08#
root@AR:/usr/local/haggis-site/tycho.ws-site/src/blog/2016/08# cd /usr/local/haggis-site/tycho.ws-site/
root@AR:/usr/local/haggis-site/tycho.ws-site# haggis --input . --output output

演示网站:http://tc.smt.biz.st, http://tycho.ws (程序作者的示范网站)
项目地址:https://github.com/tych0/haggis
https://github.com/tych0/tycho.ws
此静态博客程序似乎不支持分页。