先按此文http://briteming.blogspot.com/2016/07/hakyll.html,搭建stack,ghc,hakyll.
cd /usr/local
git clone https://github.com/odhug/odhug.github.com
cd odhug.github.com
cd /usr/local
git clone https://github.com/odhug/odhug.github.com
cd odhug.github.com
root@AR:/usr/local/odhug.github.com# ls
CNAME index.html README.md site source update
root@AR:/usr/local/odhug.github.com# cd source
root@AR:/usr/local/odhug.github.com/source# ls
aboutf.md css images LICENSE~ Odhug.hs stack.yaml
about.md events.js js odhug.cabal posts templates
_cache hacaton.md LICENSE odhug.cabal~
root@AR:/usr/local/odhug.github.com/source# stack build
会显示:
...
Linking .stack-work/dist/i386-linux/Cabal-1.24.0.0/build/Odhug/Odhug ...
odhug-0.9.2.0: copy/register
Installing executable(s) in
/usr/local/odhug.github.com/source/.stack-work/install/i386-linux/lts-7.9/8.0.1/bin
...
root@AR:/usr/local/odhug.github.com/source# .stack-work/dist/i386-linux/Cabal-1.24.0.0/build/Odhug/Odhug build (这就是生成/更新静态网站的根目录的命令)
root@AR:/usr/local/odhug.github.com/source# ls
aboutf.md css images LICENSE~ Odhug.hs stack.yaml
about.md events.js js odhug.cabal posts templates
_cache hacaton.md LICENSE odhug.cabal~ _site
( 生成了_site目录)
root@AR:/usr/local/odhug.github.com/source# cd _site
root@AR:/usr/local/odhug.github.com/source/_site# ls
aboutf.html css images js rss.xml
blog.html forum.html index.html posts
root@AR:/usr/local/odhug.github.com/source/_site#
(可见/usr/local/odhug.github.com/source/_site就是静态网站的根目录)
新建源帖:
root@AR:/usr/local/odhug.github.com/source/_site# cd ..
root@AR:/usr/local/odhug.github.com/source# ls
aboutf.md css images LICENSE~ Odhug.hs stack.yaml
about.md events.js js odhug.cabal posts templates
_cache hacaton.md LICENSE odhug.cabal~ _site
root@AR:/usr/local/odhug.github.com/source# cd posts
root@AR:/usr/local/odhug.github.com/source/posts# nano 2016-11-16-test-1.md
root@AR:/usr/local/odhug.github.com/source/posts# cat 2016-11-16-test-1.md
---
title: 测试1
date: 2016-11-16
author: brite fisherman
---
这是测试1.
看看如何?
root@AR:/usr/local/odhug.github.com/source/posts# cd ..
root@AR:/usr/local/odhug.github.com/source# .stack-work/dist/i386-linux/Cabal-1.24.0.0/build/Odhug/Odhug build
演示网站:http://hou.bright.biz.st, http://hou.bright.biz.st/blog.html
项目地址:https://github.com/odhug/odhug.github.com
https://github.com/odhug/odhug.github.com/issues/39
https://github.com/odhug/odhug.github.com/issues/39
注意:在运行stack build时,如果你遇到我曾经遇到过的错误https://github.com/odhug/odhug.github.com/issues/39,那么可能是因为你的stack的版本太老了(我的是
Version 1.1.2)。解决办法:
rm /usr/local/bin/stack
curl -sSL https://get.haskellstack.org/ | sh (重新安装stack)
这样安装出来的stack的版本为目前的最新版1.2.0.然后运行stack build就不会遇错了。