Total Pageviews

Sunday, 21 August 2016

搭建基于hakyll的静态博客程序freizl.github.com

先安装ghc和hakyll.
cd /usr/local
git clone https://github.com/freizl/freizl.github.com
cd freizl.github.com

root@AR:/usr/local/freizl.github.com# ls
404.html  codes        cv     images posts.html  slides
apps   _config.yml  favicon.ico  index.html README.md   tags
build   css       ftp     posts rss.xml

root@AR:/usr/local/freizl.github.com# cd build
root@AR:/usr/local/freizl.github.com/build# ls
404.html  cv index.html  posts      slides   templates
codes   freizl.cabal LICENSE     README.md  src
css   images Makefile    Setup.hs   stack.yaml
root@AR:/usr/local/freizl.github.com/build# stack build
会显示:
...
Linking .stack-work/dist/i386-linux/Cabal-1.22.4.0/build/freizl/freizl ...
freizl-0.1.0: copy/register
Installing executable(s) in
/usr/local/freizl.github.com/build/.stack-work/install/i386-linux/lts-3.8/7.10.2/bin
Completed 123 action(s).
root@AR:/usr/local/freizl.github.com/build# 
root@AR:/usr/local/freizl.github.com/build# ls .stack-work/install/i386-linux/lts-3.8/7.10.2/bin
freizl
root@AR:/usr/local/freizl.github.com/build# .stack-work/install/i386-linux/lts-3.8/7.10.2/bin/freizl build (此即为生成/更新静态网站的命令)
(或者运行.stack-work/dist/i386-linux/Cabal-1.22.4.0/build/freizl/freizl build也可)
root@AR:/usr/local/freizl.github.com/build# ls
404.html  css images     Makefile   Setup.hs  src
_cache   cv index.html  posts      _site stack.yaml
codes   freizl.cabal LICENSE     README.md  slides templates
(生成了_site目录)
root@AR:/usr/local/freizl.github.com/build# 
root@AR:/usr/local/freizl.github.com/build# cd _site
root@AR:/usr/local/freizl.github.com/build/_site# ls
404.html  css  images   posts       rss.xml tags
codes   cv   index.html  posts.html  slides
root@AR:/usr/local/freizl.github.com/build/_site# 
(可见/usr/local/freizl.github.com/build/_site/就是静态网站的根目录)

新建源贴:
root@AR:/usr/local/freizl.github.com/build/_site# cd ..
root@AR:/usr/local/freizl.github.com/build# cd posts
root@AR:/usr/local/freizl.github.com/build/posts# nano 2016-08-21-1604-test-1.md
root@AR:/usr/local/freizl.github.com/build/posts# cat 2016-08-21-1604-test-1.md
---
title: 测试1
tags: misc1, misc2, misc3
---

这是测试1.
root@AR:/usr/local/freizl.github.com/build/posts# cd ..
root@AR:/usr/local/freizl.github.com/build# .stack-work/dist/i386-linux/Cabal-1.22.4.0/build/freizl/freizl build

演示网站:http://surmount.biz.st:4284,http://frz.brite.biz.st
项目地址:https://github.com/freizl/freizl.github.com
https://github.com/freizl/freizl.github.com/tree/master/build