先按此文http://briteming.blogspot.com/2016/07/hakyll.html安装stack和ghc.
cd /usr/local
git clone https://github.com/benkolera/benkolera.com
cd benkolera.com
root@AR:/usr/local/benkolera.com# ls
about.md contact.markdown LICENSE Setup.hs templates
blog.cabal css livereload.js bower.json favicon.ico package.json site.hs
cabal.sandbox.config images posts index.html README.md talks
root@AR:/usr/local/benkolera.com# stack init (因为benkolera.com/目录里面有cabal文件,于是可运行stack init,会生成stack.yaml文件)
root@AR:/usr/local/benkolera.com# stack build (因为生成了stack.yaml,于是可运行stack build)
会显示:
...
Linking .stack-work/dist/i386-linux/Cabal-1.22.5.0/build/site/site ...
blog-0.1.0.0: copy/register
Installing executable(s) in
/usr/local/benkolera.com/.stack-work/install/i386-linux/lts-5.18/7.10.3/bin
root@AR:/usr/local/benkolera.com# .stack-work/dist/i386-linux/Cabal-1.22.5.0/build/site/site build
(此即生成/更新静态网站的根目录的命令)
root@AR:/usr/local/benkolera.com# ls
about.md contact.markdown LICENSE Setup.hs templates
blog.cabal css livereload.js _site
bower.json favicon.ico package.json site.hs
cabal.sandbox.config images posts stack.yaml
_cache index.html README.md talks
(生成了_site目录)
root@AR:/usr/local/benkolera.com# cd _site
root@AR:/usr/local/benkolera.com/_site# ls
about.html drafts.html index.html tags talks.html
atom.xml favicon.ico posts tags.html
css images posts.html talks
root@AR:/usr/local/benkolera.com/_site#
(可见 /usr/local/benkolera.com/_site就是静态网站的根目录)
新建源帖:
root@AR:/usr/local/benkolera.com/_site# cd ..
root@AR:/usr/local/benkolera.com# cd posts
root@AR:/usr/local/benkolera.com/posts# nano 2016-12-26-test-1.md
root@AR:/usr/local/benkolera.com/posts# cat 2016-12-26-test-1.md
---
title: 测试1
type: post
tags: misc1, misc2, misc3
---
这是测试1.
root@AR:/usr/local/benkolera.com/posts# cd ..
root@AR:/usr/local/benkolera.com# .stack-work/dist/i386-linux/Cabal-1.22.5.0/build/site/site build
演示网站:http://bk.bright.biz.st/
项目地址:https://github.com/benkolera/benkolera.com
注:源码中有site.hs,但是运行ghc --make site.hs遇错。
源码中有cabal文件,运行cabal sandbox init,然后运行cabal install遇错。
源码中有cabal文件,运行stack init,然后运行stack build,这一次没有再遇错。