Pages

Monday, 6 February 2017

搭建基于haskell的静态博客程序xkpb-blog

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

cd /usr/local
git clone https://github.com/xkpb/blog pab.io


root@AR:/usr/local/pab.io# ghc --make site.hs
root@AR:/usr/local/pab.io# ./site build
root@AR:/usr/local/pab.io# cd _site
root@AR:/usr/local/pab.io/_site# ls
blog.html  contact.html  css  cv.html  images  index.html  posts  rss.xml
root@AR:/usr/local/pab.io/_site#
(可见/usr/local/pab.io/_site就是静态网站的根目录)

新建源帖:
root@AR:/usr/local/pab.io/_site# cd ../posts
root@AR:/usr/local/pab.io/posts# nano 2017-02-07-test-1.org
root@AR:/usr/local/pab.io/posts# cat 2017-02-07-test-1.org
---
title: 测试1
---

这是测试1.

看看如何?
root@AR:/usr/local/pab.io/posts# cd ..
root@AR:/usr/local/pab.io# ./site rebuild

演示网站:http://xb.bright.biz.st, http://xb.bright.biz.st/blog.html
项目地址:https://github.com/xkpb/blog

注:上面写源帖时,如果你要嵌入html code,比如视频代码,那么源帖的后缀需为md.如果用org后缀,源帖发表后,对应的文章显示的依然是html code.

No comments:

Post a Comment