先安装ghc,cabal,stack和hakyll.
cd /usr/local
git clone https://github.com/HaskellMN/www.haskell.mn
cd www.haskell.mn
cd /usr/local
git clone https://github.com/HaskellMN/www.haskell.mn
cd www.haskell.mn
root@AR:/usr/local/www.haskell.mn# ls
404.md images posts stack.yaml
_cache index.md README.md site.hs
check.sh LICENSE robots.txt templates
css new_post.py Setup.hs www-haskell-mn.cabal
root@AR:/usr/local/www.haskell.mn# ghc --make site.hs
(此命令是用来生成博客程序的可执行文件,因为有site.hs文件。
另外2个办法:
因为有stack.yaml 文件,所以也可运行stack build来生成博客程序的可执行文件.
因为有.cabal文件,所以也可运行:cabal sandbox init && cabal install来生成博客程序的可执行文件.)
root@AR:/usr/local/www.haskell.mn# ls
404.md images posts site site.o
_cache index.md README.md stack.yaml
check.sh LICENSE robots.txt site.hi templates
css new_post.py Setup.hs site.hs www-haskell-mn.cabal
(生成了可执行文件site)
root@AR:/usr/local/www.haskell.mn# ./site build (此为生成/更新静态网站的命令)
root@AR:/usr/local/www.haskell.mn# ls
404.md images posts site site.o
_cache index.md README.md _site stack.yaml
check.sh LICENSE robots.txt site.hi templates
css new_post.py Setup.hs site.hs www-haskell-mn.cabal
(生成了_site目录)
root@AR:/usr/local/www.haskell.mn# cd _site
root@AR:/usr/local/www.haskell.mn/_site# ls
404.html atom.xml images posts robots.txt
archive.html css index.html README.html tweets.xml
root@AR:/usr/local/www.haskell.mn/_site#
(可见/usr/local/www.haskell.mn/_site/就是静态网站的根目录)
新建源贴:
root@AR:/usr/local/www.haskell.mn/_site# cd ..
root@AR:/usr/local/www.haskell.mn# cd posts
root@AR:/usr/local/www.haskell.mn/posts# nano 2016-08-23-1309-test-1.md
root@AR:/usr/local/www.haskell.mn/posts# cat 2016-08-23-1309-test-1.md
---
title: 测试1
description: xyz
author: brite
---
这是测试1.
(注意:description: xyz其实不起什么作用,但是这行不可少,否则build时,会遇错。)
root@AR:/usr/local/www.haskell.mn/posts# cd ..
root@AR:/usr/local/www.haskell.mn# ./site build
演示网站:http://surmount.biz.st:5329/archive.html,http://hkmn.smt.biz.st,
http://hkmn.smt.biz.st/archive.html
项目地址:https://github.com/HaskellMN/www.haskell.mn