首先按此文http://briteming.blogspot.com/2016/07/hakyll.html安装stack,ghc和hakyll.
git clone https://github.com/google/zopfli
cd zopfil
make (此命令会在当前目录下,生成可执行文件zopfil)
cd zopfil /usr/bin/
cd /usr/local
git clone https://github.com/ruuda/blog ruuda-blog
cd ruuda-blog
git clone https://github.com/google/zopfli
cd zopfil
make (此命令会在当前目录下,生成可执行文件zopfil)
cd zopfil /usr/bin/
cd /usr/local
git clone https://github.com/ruuda/blog ruuda-blog
cd ruuda-blog
root@AR:/usr/local/ruuda-blog# ls
assets fonts licence posts src templates
blog.cabal images readme.md stack.yaml tools
root@AR:/usr/local/ruuda-blog# stack build
显示:
...
Linking
.stack-work/dist/i386-linux/Cabal-1.24.0.0/build/blog/blog
...
root@AR:/usr/local/ruuda-blog# .stack-work/dist/i386-linux/Cabal-1.24.0.0/build/blog/blog build (此即生成静态网站的根目录的命令)
root@AR:/usr/local/ruuda-blog# ls
assets fonts licence posts src templates
blog.cabal images out readme.md stack.yaml tools
(生成了out目录)
root@AR:/usr/local/ruuda-blog# cd out
root@AR:/usr/local/ruuda-blog/out# ls
2011 2013 2015 contact feed.xml fonts index.html writing
2012 2014 2016 favicon.png feed.xml.gz images index.html.gz
root@AR:/usr/local/ruuda-blog/out#
(可见/usr/local/ruuda-blog/out就是静态网站的根目录)
新建源贴:
root@AR:/usr/local/ruuda-blog/out# cd ../posts
root@AR:/usr/local/ruuda-blog/posts# nano test-1.md
root@AR:/usr/local/ruuda-blog/posts# cat test-1.md
---
title: 测试1
date: 2016-11-05
synopsis: 点击链接看全文
---
这是测试1.
看看如何呢?
root@AR:/usr/local/ruuda-blog/posts# cd ..
root@AR:/usr/local/ruuda-blog# .stack-work/dist/i386-linux/Cabal-1.24.0.0/build/blog/blog build (运行此命令后,会有一些出错提示,无关紧要)
演示网站:http://rb.bright.biz.st,http://rb.bright.biz.st/writing/, 在这个博客程序里,同一天发表的帖子不是按时间顺序排列的。
(第一次访问域名地址http://rb.bright.biz.st时,会显示internal server error的错误。解决办法:
root@AR:/usr/local/ruuda-blog# cd out
root@AR:/usr/local/ruuda-blog# cd out
root@AR:/usr/local/ruuda-blog/out# rm .htaccess
注意:每次更新网站后,out目录都会重新生成.htaccess文件,所以每次更新网站后,都要记得删除out目录里的.htaccess文件)
注意:每次更新网站后,out目录都会重新生成.htaccess文件,所以每次更新网站后,都要记得删除out目录里的.htaccess文件)
项目地址:https://github.com/ruuda/blog