Pages

Sunday, 15 January 2017

搭建基于haskell的静态博客程序sbrg-site

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

cd /usr/local
git clone https://github.com/saevarb/sbrg/ sbrg-site
cd sbrg-site

root@AR:/usr/local/sbrg-site# ls
LICENSE   css        images       posts       teaching
Setup.hs  cv.md      index.html  sbrgme.cabal  site.hs  templates
TODO      about.md  deploy.sh  js              
root@AR:/usr/local/sbrg-site# ghc --make site.hs
root@AR:/usr/local/sbrg-site# ls
LICENSE      css        images       posts     site.hi  teaching
Setup.hs      cv.md      index.html  sbrgme.cabal  site.hs  templates
TODO      about.md  deploy.sh  js       site         site.o
(生成了可执行文件site)
root@AR:/usr/local/sbrg-site# ./site build
root@AR:/usr/local/sbrg-site# ls
LICENSE   _cache    css        images       posts     site.hi  teaching
Setup.hs  _site     cv.md      index.html  sbrgme.cabal  site.hs  templates
TODO      about.md  deploy.sh  js       site         site.o
(生成了_site目录)
root@AR:/usr/local/sbrg-site# cd _site
root@AR:/usr/local/sbrg-site/_site# ls
about.html  archive.html  css  posts
(缺乏index.html)
root@AR:/usr/local/sbrg-site/_site# nano index.html
(内容为:<meta http-equiv=refresh content='0;url=/archive.html'> )
/usr/local/sbrg-site/_site就是静态网站的根目录。

新建源帖:
 root@AR:/usr/local/sbrg-site/_site# cd ../posts
root@AR:/usr/local/sbrg-site/posts# nano 2017-01-12-test-1.md
root@AR:/usr/local/sbrg-site/posts# cat 2017-01-12-test-1.md
---
title: 测试1
author: brite fisherman
---

这是测试1.

看看如何?

root@AR:/usr/local/sbrg-site/posts# cd ..
root@AR:/usr/local/sbrg-site# ./site rebuild
root@AR:/usr/local/sbrg-site# cd _site
root@AR:/usr/local/sbrg-site/_site# ls
about.html  archive.html  css  posts
root@AR:/usr/local/sbrg-site/_site# nano index.html
root@AR:/usr/local/sbrg-site/_site# cat index.html
<meta http-equiv=refresh content='0;url=/archive.html'>
root@AR:/usr/local/sbrg-site/_site#

演示网站:http://sbrg.bright.biz.st/
项目地址:  https://github.com/saevarb/sbrg/

跟这个http://briteming.blogspot.jp/2017/01/haskellpolo2ro-blog.html几乎如出一辙。

No comments:

Post a Comment