Total Pageviews

Wednesday, 24 August 2016

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

先安装ghc.

cd /usr/local/
git clone https://github.com/raindev/raindev.github.io
cd raindev.github.io

root@AR:/usr/local/raindev.github.io# ls
about.html    CNAME     images Makefile   sitemap.xml
archive.html  contact.html  index.html README.md  space-leader.html
atom.xml      css     LICENSE rss.xml    src

root@AR:/usr/local/raindev.github.io# cd src
root@AR:/usr/local/raindev.github.io/src# ls
about.md    _cache css    images   posts  site.hs  templates
blog.cabal  contact.md hooks  index.html       
root@AR:/usr/local/raindev.github.io/src# ghc --make site.hs
root@AR:/usr/local/raindev.github.io/src# ls
about.md    _cache css    images   posts  site.hs  templates
blog.cabal  contact.md hooks  index.html  site   site.hi  site.o
root@AR:/usr/local/raindev.github.io/src# ./site build
root@AR:/usr/local/raindev.github.io/src# ls
about.md    _cache css    images   posts  _site    site.hs  templates
blog.cabal  contact.md hooks  index.html  site   site.hi  site.o
root@AR:/usr/local/raindev.github.io/src# cd _site
root@AR:/usr/local/raindev.github.io/src/_site# ls
about.html    images
archive.html  index.html
atom.xml      rss.xml
contact.html  space-leader.html
css     
root@AR:/usr/local/raindev.github.io/src/_site#
(可见/usr/local/raindev.github.io/src/_site/就是静态网站的根目录)

新建源贴:
root@AR:/usr/local/raindev.github.io/src/_site# cd .. 
root@AR:/usr/local/raindev.github.io/src# cd posts
root@AR:/usr/local/raindev.github.io/src/posts#(((( ls 
space-leader.md 
root@AR:/usr/local/raindev.github.io/src/posts# mv space-leader.md 2016-02-27-1012
-space-leader.md 
(这里把space-leader.md重命名为2016-02-27-1012-space-leader.md,是为了帖子发表后,按时间顺序排列。1012即10点12分。)
root@AR:/usr/local/raindev.github.io/src/posts# nano 2016-08-24-1917-test-1.md
root@AR:/usr/local/raindev.github.io/src/posts# cat 2016-08-24-1917-test-1.md
---
title: 测试1
date: August 24, 2016
---

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

演示网站:http://rd.smt.biz.st
项目地址:https://github.com/raindev/raindev.github.io