Pages

Monday, 16 January 2017

搭建基于haskell的静态博客程序heather.github.io

先按此文http://briteming.blogspot.jp/2016/07/hakyll.html,安装stack和ghc.(不要安装hakyll.如果你已经安装了hakyll,则删除其可执行文件:rm /root/.local/bin//hakyll)
然后stack install cabal-install

cd /usr/local
cabal update
cabal install happy
cabal install alex
cabal install language-javascript
cabal install hjsmin
cabal install hakyll
cabal install clay
cabal install lucid
git clone https://github.com/heather/heather.github.io
cd  heather.github.io

root@localhost:/usr/local/heather.github.io# cd src
root@localhost:/usr/local/heather.github.io/src# ghc --make site.hs
root@localhost:/usr/local/heather.github.io/src# ./site build
root@localhost:/usr/local/heather.github.io/src# ls
_cache  css  hs  js  posts  site  _site  site.hi  site.hs  site.o  templates
root@localhost:/usr/local/heather.github.io/src# cd _site
root@localhost:/usr/local/heather.github.io/src/_site# ls
404.html  atom.xml  css  index.html  js  posts
root@localhost:/usr/local/heather.github.io/src/_site#
(可见/usr/local/heather.github.io/src/_site就是静态网站的根目录)

新建源帖:
root@localhost:/usr/local/heather.github.io/src/_site# cd ..
root@localhost:/usr/local/heather.github.io/src# cd posts
root@localhost:/usr/local/heather.github.io/src/posts# nano 2017-01-12-test-1.md
root@localhost:/usr/local/heather.github.io/src/posts# cat 2017-01-12-test-1.md
---
title: 测试1
---

这是测试1.

看看如何?

root@localhost:/usr/local/heather.github.io/src/posts#  cd ..
root@localhost:/usr/local/heather.github.io/src# ./site build

演示网站:http://ht.bright.biz.st/
项目地址:https://github.com/heather/heather.github.io

注:我是在kvm vps上搭建成功的。在openvz vps上失败, 主要是因为在openvz vps上,clay未安装成功。

No comments:

Post a Comment