Total Pageviews

Thursday 25 August 2016

搭建基于hakyll的静态博客程序haskell-101

先安装ghc.

cd /usr/local
git clone https://github.com/smorele/haskell-101 haskell-101-site
cd haskell-101-site

root@AR:/usr/local/haskell-101-site# ls
_cache haskell101.cabal  posts  site.hs  stack.yaml
css index.html   templates

root@AR:/usr/local/haskell-101-site# ghc --make  site.hs
root@AR:/usr/local/haskell-101-site# ls
_cache haskell101.cabal  posts  site.hs  stack.yaml
css index.html   site site.hi  site.o   templates
root@AR:/usr/local/haskell-101-site# ./site build
显示:
...
 [ERROR] Missing field $entries$ in context for item sitemap.xml
(这个错误不重要,不用理它)
root@AR:/usr/local/haskell-101-site# ls
_cache haskell101.cabal  posts  _site   site.hs  stack.yaml
css index.html   site site.hi  site.o   templates
root@AR:/usr/local/haskell-101-site# cd _site
root@AR:/usr/local/haskell-101-site/_site# ls
archive.html  css  index.html  posts
root@AR:/usr/local/haskell-101-site/_site#
(可见/usr/local/haskell-101-site/_site/就是静态网站的根目录)

新建源贴:
root@AR:/usr/local/haskell-101-site/_site# cd ../posts
root@AR:/usr/local/haskell-101-site/posts# rm *.markdown
root@AR:/usr/local/haskell-101-site/posts# nano 2016-08-25-1743-test-1.markdown 
root@AR:/usr/local/haskell-101-site/posts# cat 2016-08-25-1743-test-1.markdown 
---
title: 测试1
---

这是测试1.
root@AR:/usr/local/haskell-101-site/posts# cd ..
root@AR:/usr/local/haskell-101-site# ./site build

演示网站:http://hk101.smt.biz.st
项目地址:https://github.com/smorele/haskell-101