Total Pageviews

Friday, 21 October 2016

搭建基于hakyll的静态博客程序listx_blog

首先按此文http://briteming.blogspot.com/2016/07/haskellghc.html,安装ghc和cabal.
按此文http://briteming.blogspot.com/2016/07/hakyll.html,安装hakyll.
然后,
cabal update
cabal install clay
(参见http://fvisser.nl/clay/)
cd /usr/local
git clone https://github.com/listx/listx_blog funloop.org
cd funloop.org
ghc --make blog.hs (此命令会在当前目录下,生成可执行文件blog)

root@AR:/usr/local/funloop.org# ls
about.md    _cache file post
art.md    CNAME img  README.md
blog    code LICENSE  
blog.cabal  code.md lightpaperfibers_JorgeFuentes.png  sync.sh
blog.hi     css Makefile   template
blog.hs     favicon.png  misc.js xv_lasma.png
blog.o    favicon.xcf  papers.md
root@AR:/usr/local/funloop.org# ./blog rebuild (此即为生成静态网站的根目录的命令.
如果遇错,请先运行export LC_ALL=C.UTF-8 )
root@AR:/usr/local/funloop.org# ./blog rebuild
会显示:
...
[ERROR] Hakyll.Core.UnixFilter.unixFilterWith: cabal exec -- runghc -- -fno-warn-tabs gave exit code 1
(这个错误暂时,我没办法解决。)
root@AR:/usr/local/funloop.org#

root@AR:/usr/local/funloop.org# ls
about.md    _cache file     post
art.md     CNAME img     README.md
blog     code LICENSE     _site
blog.cabal  code.md lightpaperfibers_JorgeFuentes.png  sync.sh
blog.hi     css Makefile     template
blog.hs     favicon.png  misc.js     xv_lasma.png
blog.o     favicon.xcf  papers.md
root@AR:/usr/local/funloop.org# cd _site
root@AR:/usr/local/funloop.org/_site# ls
about.html    code   img       post
archive.html  code.html          tag
art.html      css   lightpaperfibers_JorgeFuentes.png  xv_lasma.png
atom.xml      favicon.png  misc.js
CNAME       file   papers.html
root@AR:/usr/local/funloop.org/_site# nano index.html
root@AR:/usr/local/funloop.org/_site# cat index.html
(可见/usr/local/funloop.org/_site就是静态网站的根目录)

新建源贴:
root@AR:/usr/local/funloop.org/_site# cd ..
root@AR:/usr/local/funloop.org# cd post
root@AR:/usr/local/funloop.org/post# nano 2016-10-21-test-1.md
root@AR:/usr/local/funloop.org/post# cat 2016-10-21-test-1.md
---
title: "测试1"
tags: misc1, misc2, misc3
mathjax: on
---

这是测试1.
root@AR:/usr/local/funloop.org/post# cd ..
root@AR:/usr/local/funloop.org# ./blog rebuild

演示网站:http://lb.bright.biz.st/archive.html
http://funloop.org(程序作者的网站)
项目地址:https://github.com/listx/listx_blog