Total Pageviews

Friday 26 August 2016

搭建基于hakyll的静态博客程序beerendlauwers.github.io

请先按此文http://briteming.blogspot.com/2016/07/hakyll.html安装hakyll.

cd /usr/local
git clone -b code https://github.com/beerendlauwers/beerendlauwers.github.io
cd beerendlauwers.github.io

root@AR:/usr/local/beerendlauwers.github.io# ls
about.rst       contact.markdown index.html     stack.yaml
beerendlauwers.cabal  css Makefile       templates
_cache       drafts posts        site.hs
circle.yml       fonts project-ideas 
CNAME       images resume       

root@AR:/usr/local/beerendlauwers.github.io# ghc --make site.hs
root@AR:/usr/local/beerendlauwers.github.io# ls
about.rst       contact.markdown index.html     site stack.yaml
beerendlauwers.cabal  css Makefile       templates
_cache       drafts posts       site.hi
circle.yml       fonts project-ideas  site.hs
CNAME       images resume       site.o
root@AR:/usr/local/beerendlauwers.github.io# ./site build
(此即生成/更新静态网站的命令。在运行它时,遇到错误:
[ERROR] ./posts/2015-11-06-atom-and-haskell-extensions.markdown: YAML parse exception at line 2, column 43:
mapping values are not allowed in this context
Hint: if the metadata value contains characters such
as ':' or '-', try enclosing it in quotes.
于是编辑./posts/2015-11-06-atom-and-haskell-extensions.markdown,把title的值用引号包起来。大致有3个markdown文件要这样修改。每次运行./site build都会提示一次。最后再运行运行一次./site build就正常了)
root@AR:/usr/local/beerendlauwers.github.io# ls
about.rst       contact.markdown index.html     site stack.yaml
beerendlauwers.cabal  css Makefile       _site templates
_cache       drafts posts       site.hi  
circle.yml       fonts project-ideas  site.hs
CNAME       images resume       site.o
root@AR:/usr/local/beerendlauwers.github.io# cd _site
root@AR:/usr/local/beerendlauwers.github.io/_site# ls
about.html    contact.html  fonts   index.html project-ideas     resume
archive.html  css     images  posts project-ideas.html
root@AR:/usr/local/beerendlauwers.github.io/_site# 
(可见/usr/local/beerendlauwers.github.io/_site/就是静态网站的根目录)

新建源贴:
root@AR:/usr/local/beerendlauwers.github.io/_site# cd ../posts
root@AR:/usr/local/beerendlauwers.github.io/posts# nano 2016-08-26-1954-test-1.markdown
root@AR:/usr/local/beerendlauwers.github.io/posts# cat 2016-08-26-1954-test-1.markdown
---
title: 测试1
---

这是测试1.
root@AR:/usr/local/beerendlauwers.github.io/posts# cd ..
root@AR:/usr/local/beerendlauwers.github.io# ./site build

演示网站;http://surmount.biz.st:5429,http://bl.smt.biz.st
项目地址:https://github.com/beerendlauwers/beerendlauwers.github.io/tree/code