Total Pageviews

Thursday, 18 August 2016

搭建基于hakyll的静态博客程序javrania

先按此文http://briteming.blogspot.com/2016/07/haskellghc.html ,安装ghc/cabal.
cd /usr/local/
git clone https://github.com/Javran/javrania javrania
cd javrania

root@AR:/usr/local/javrania# ls
javran.github.io Makefile  TODO.md
do-deploy.sh  javrania.hs  site-source

root@AR:/usr/local/javrania# make
root@AR:/usr/local/javrania# ls
javran.github.io javrania.hi  javrania.o  TODO.md
do-deploy.sh  javrania javrania.hs  Makefile site-source
(生成的javrania就是可执行文件.运行make,其实就是运行ghc --make javrania.hs,就会生成javrania这个可执行文件)
root@AR:/usr/local/javrania# ./javrania build (这个就是生成/更新静态网站的命令)
root@AR:/usr/local/javrania# ls
_cache       javran.github.io javrania.hi  javrania.o  site-generated  TODO.md
do-deploy.sh  javrania javrania.hs  Makefile site-source
(生成了site-generated 目录)
root@AR:/usr/local/javrania# cd site-generated 
root@AR:/usr/local/javrania/site-generated# ls
about.html    atom.xml favicon.ico  images js rss.xml
archive.html  css fonts     index.html  posts tags
root@AR:/usr/local/javrania/site-generated#
(可见/usr/local/javrania/site-generated/就是静态网站的根目录)

新建源贴:
root@AR:/usr/local/javrania/site-generated# cd ..
root@AR:/usr/local/javrania# ls
_cache       javran.github.io javrania.hi  javrania.o  site-generated  TODO.md
do-deploy.sh  javrania javrania.hs  Makefile site-source
root@AR:/usr/local/javrania# cd site-source
root@AR:/usr/local/javrania/site-source# ls
about.markdown css  favicon.ico  fonts  images  index.html  js  posts templates
root@AR:/usr/local/javrania/site-source# cd posts
root@AR:/usr/local/javrania/site-source/posts# ls
2012-10-13-another-beginning.md   2014-02-25-yet-another-beginning.md
2012-10-14-made-a-favicon.md   2016-08-18-1118-test-1.md
2012-10-19-game-of-thinking.md   2016-08-18-1132-test-2.md
2012-10-29-android-development-without-eclipse.md  2016-08-18-1134-chinese-economy.md
2013-04-19-keep-thinking.md   2016-08-18-1139-magic-thief.md
root@AR:/usr/local/javrania/site-source/posts# nano 2016-08-18-1118-test-1.md
2016-08-18-1118-test-1.md里面的1118是11点18分的意思。内容格式如下:
---
layout: post
title: 测试1
tags: misc
---

这是测试1. )

root@AR:/usr/local/javrania/site-source/posts# cd /usr/local/javrania/
root@AR:/usr/local/javrania# ls
_cache       javran.github.io javrania.hi  javrania.o  site-generated  TODO.md
do-deploy.sh  javrania javrania.hs  Makefile site-source
root@AR:/usr/local/javrania# ./javrania build

演示网站:http://jrn.smt.biz.st,http://javran.github.io(程序作者用此程序搭建的博客)
项目地址:https://github.com/Javran/javrania
查看https://github.com/Javran/javrania/blob/master/javrania.hs,第二行为“import Hakyll”,可知本程序是基于hakyll的。