Pages

Friday, 11 November 2016

搭建基于hakyll的静态博客程序gisli.hamstur.is

首先按此文首先按此文http://briteming.blogspot.com/2016/07/hakyll.html安装stack,ghc和hakyll.

cd /usr/local
git clone https://github.com/gislik/gisli.hamstur.is
cd gisli.hamstur.is
stack init
stack setup --resolver ghc-7.10.3
stack build
会显示:
...
Linking:
.stack-work/dist/i386-linux/Cabal-1.22.5.0/build/blog/blog
...

root@AR:/usr/local/gisli.hamstur.is# .stack-work/dist/i386-linux/Cabal-1.22.5.0/build/blog/blog build (这个就是生成/更新静态网站的根目录的命令)
root@AR:/usr/local/gisli.hamstur.is# ls
assets     favicon.png projects.markdown  slides
blog     google061fe900d4ac0d53.html  publish.sh     stack.yaml
blog.cabal  img README.md     templates
build.sh    index.html Setup.hs     video
_cache     keybase.txt _site
CNAME     LICENSE site.hs
(生成了_site目录)
root@AR:/usr/local/gisli.hamstur.is# cd _site
root@AR:/usr/local/gisli.hamstur.is/_site# ls
1     2008  2012  4   favicon.png index.html   robotics
2     2009  2016  assets   haskell keybase.txt  rss
2007  2010  3   bitcoin  img projects     slides
root@AR:/usr/local/gisli.hamstur.is/_site#
(可见/usr/local/gisli.hamstur.is/_site目录就是静态网站的根目录)

新建源帖:
root@AR:/usr/local/gisli.hamstur.is/_site# 
root@AR:/usr/local/gisli.hamstur.is/_site# cd ../blog/
root@AR:/usr/local/gisli.hamstur.is/blog# ls
bitcoin  general  haskell  robotics
root@AR:/usr/local/gisli.hamstur.is/blog# cd bitcoin
root@AR:/usr/local/gisli.hamstur.is/blog/bitcoin# nano 2016-11-11-test-1.markdown
root@AR:/usr/local/gisli.hamstur.is/blog/bitcoin# cat 2016-11-11-test-1.markdown
---
title: 测试1
---

这是测试1.

看看如何?
(支持用<!--more-->截断文章。)
root@AR:/usr/local/gisli.hamstur.is/blog/bitcoin# cd ../..
root@AR:/usr/local/gisli.hamstur.is# .stack-work/dist/i386-linux/Cabal-1.22.5.0/build/blog/blog build

演示网站:http://hs.bright.biz.st/
项目地址:https://github.com/gislik/gisli.hamstur.is