Total Pageviews

Tuesday 23 August 2016

搭建基于hakyll的静态博客程序tesser.org

先安装ghc和cabal.

cd /usr/local
git clone https://github.com/olorin/tesser.org
cd tesser.org

root@AR:/usr/local/tesser.org# ls
cabal.sandbox.config  dist  index.md  Makefile stack.yaml    var
_cache       doc   LICENSE   README.md  templates
css       img   main      tesser.cabal

root@AR:/usr/local/tesser.org# cabal sandbox init
root@AR:/usr/local/tesser.org# cabal install (此命令会在当前目录下,生成.cabal-sandbox目录。可执行文件会生成于.cabal-sandbox/bin/下。)
root@AR:/usr/local/tesser.org# cd .cabal-sandbox
root@AR:/usr/local/tesser.org/.cabal-sandbox# ls
add-source-timestamps  i386-linux-ghc-7.10.3-packages.conf.d  logs share
bin       lib       packages
root@AR:/usr/local/tesser.org/.cabal-sandbox# cd bin
root@AR:/usr/local/tesser.org/.cabal-sandbox/bin# ls
aeson-pretty  json2yaml  pandoc-citeproc  yaml2json
hakyll-init   pandoc tesser
root@AR:/usr/local/tesser.org/.cabal-sandbox/bin#
(/usr/local/tesser.org/.cabal-sandbox/bin/tesser 就是可执行文件)
root@AR:/usr/local/tesser.org/.cabal-sandbox/bin# cd ../..
root@AR:/usr/local/tesser.org# .cabal-sandbox/bin/tesser build (此即生成/更新静态网站的命令)
root@AR:/usr/local/tesser.org# ls
cabal.sandbox.config  dist  index.md  Makefile stack.yaml    var
_cache       doc   LICENSE   README.md  templates
css       img   main      _site tesser.cabal
(生成了_site目录)
root@AR:/usr/local/tesser.org# cd _site
root@AR:/usr/local/tesser.org/_site# ls
atom.xml  css  doc  index.html rss.xml  tags  var
(可见/usr/local/tesser.org/_site/就是静态网站的根目录)
root@AR:/usr/local/tesser.org/_site# 

新建源贴:
root@AR:/usr/local/tesser.org/_site# cd ..
root@AR:/usr/local/tesser.org# ls
cabal.sandbox.config  dist  index.md  Makefile stack.yaml    var
_cache       doc   LICENSE   README.md  templates
css       img   main      _site tesser.cabal
root@AR:/usr/local/tesser.org# cd doc
root@AR:/usr/local/tesser.org/doc# ls
index.html  posts  slides
root@AR:/usr/local/tesser.org/doc# cd posts
root@AR:/usr/local/tesser.org/doc/posts# ls
2014-09-08-hackage-mirror.md
2014-11-30-medical-imaging-storage.md
2015-03-21-openbci-pluggable-power-supplies.md
2015-06-16-polyphasic-sleep-and-me.md
2015-08-21-statically-linking-libgmp-in-haskell-programs.md
img
root@AR:/usr/local/tesser.org/doc/posts# nano 2016-08-23-1525-test-1.md
root@AR:/usr/local/tesser.org/doc/posts# cat 2016-08-23-1525-test-1.md
---
title: 测试1
author: brite
tags: misc1, misc2, misc3
---

这是测试1.
root@AR:/usr/local/tesser.org/doc/posts# cd ../..
root@AR:/usr/local/tesser.org# .cabal-sandbox/bin/tesser build

演示网站:http://surmount.biz.st:6328/doc/,http://ts.smt.biz.st/doc/
项目地址:https://github.com/olorin/tesser.org