Total Pageviews

Friday, 26 August 2016

搭建基于hakyll的静态博客程序xcaptain.github.io

请先按此文http://briteming.blogspot.com/2016/07/hakyll.html安装hakyll.

cd /usr/local
git clone --branch source https://github.com/xcaptain/xcaptain.github.io xcaptain.github.io
cd xcaptain.github.io


root@AR:/usr/local/xcaptain.github.io# ls
about.rst   contact.markdown  images   site.hs
blog.cabal  css       index.html  templates   
_cache     fonts       posts   

root@AR:/usr/local/xcaptain.github.io# ghc --make site.hs
root@AR:/usr/local/xcaptain.github.io# ls
about.rst   contact.markdown  images   site   site.hs
blog.cabal  css       index.html  site.o   templates
_cache     fonts       posts   site.hi  
root@AR:/usr/local/xcaptain.github.io# ./site build
root@AR:/usr/local/xcaptain.github.io# ls
about.rst   contact.markdown  images   site   site.hs
blog.cabal  css       index.html  _site    site.o
_cache     fonts       posts   site.hi  templates
root@AR:/usr/local/xcaptain.github.io# cd _site
root@AR:/usr/local/xcaptain.github.io/_site# ls
about.html    css     index.html  posts.html  tags
contact.html  images  posts   rss.xml     tags.html
root@AR:/usr/local/xcaptain.github.io/_site#
(可见/usr/local/xcaptain.github.io/_site/就是静态网站的根目录)

新建源贴:
root@AR:/usr/local/xcaptain.github.io/_site# cd ../posts
root@AR:/usr/local/xcaptain.github.io/posts# nano 2016-08-26-1428-test-1.md
root@AR:/usr/local/xcaptain.github.io/posts# cat 2016-08-26-1428-test-1.md
---
title: 测试1
tags: misc1, misc2, misc3
---

这是测试1.
root@AR:/usr/local/xcaptain.github.io/posts# cd ..
root@AR:/usr/local/xcaptain.github.io# ./site build

演示网站:http://surmount.biz.st:3426,http://xct.smt.biz.st
项目地址:https://github.com/xcaptain/xcaptain.github.io/tree/source