Total Pageviews

Saturday, 20 August 2016

搭建基于hakyll的静态博客程序chaoxu-blog

先安装ghc和hakyll.
cd /usr/local/
git clone https://github.com/chaoxu/blog chaoxu-blog
cd chaoxu-blog

root@AR:/usr/local/chaoxu-blog# ls
404.md     MathDoc.hi     research.md
about.md     MathDoc.hs     simple-words-on-surfaces.md
bib_style.csl     MathDoc.o     site.hs
_cache     mathjax_conf.js     templates
chaoblog.cabal     mimetypes.site44.txt   test.md
css     open-problems.md     timeline.html
current.md     posts     tools.md
drafts     potential-startups.md  tricks.md
favicon.ico     problems.md     works.md
googled46bf4e1cd540289.html  puzzles.md     
index.html     README.md     
journal.md     redirects.site44.txt  
LICENSE     reference.bib     

root@AR:/usr/local/chaoxu-blog# ghc --make site.hs
root@AR:/usr/local/chaoxu-blog# ls
404.md     MathDoc.hi     research.md
about.md     MathDoc.hs     simple-words-on-surfaces.md
bib_style.csl     MathDoc.o     site
_cache     mathjax_conf.js     works.md
chaoblog.cabal     mimetypes.site44.txt   site.hi
css     open-problems.md     site.hs
current.md     posts     site.o
drafts     potential-startups.md  templates
favicon.ico     problems.md     test.md
googled46bf4e1cd540289.html  puzzles.md     timeline.html
index.html     README.md     tools.md
journal.md     redirects.site44.txt   tricks.md
LICENSE     reference.bib     
root@AR:/usr/local/chaoxu-blog# ./site build
root@AR:/usr/local/chaoxu-blog# ls
404.md     MathDoc.hi     research.md
about.md     MathDoc.hs     simple-words-on-surfaces.md
bib_style.csl     MathDoc.o     site
_cache     mathjax_conf.js     _site
chaoblog.cabal     mimetypes.site44.txt   site.hi
css     open-problems.md     site.hs
current.md     posts     site.o
drafts     potential-startups.md  templates
favicon.ico     problems.md     test.md
googled46bf4e1cd540289.html  puzzles.md     timeline.html
index.html     README.md     tools.md
journal.md     redirects.site44.txt   tricks.md
LICENSE     reference.bib     works.md
(生成了_site目录)
root@AR:/usr/local/chaoxu-blog# cd _site
root@AR:/usr/local/chaoxu-blog/_site# ls
404.html     potential-startups.html
about.html     problems.html
css     puzzles.html
current.html     README.html
drafts     redirects.site44.txt
favicon.ico     research.html
googled46bf4e1cd540289.html  simple-words-on-surfaces.html
index.html     test.html
journal.html     timeline.html
mathjax_conf.js     tools.html
mimetypes.site44.txt     tricks.html
open-problems.html     works.html
posts
root@AR:/usr/local/chaoxu-blog/_site# 
(可见/usr/local/chaoxu-blog/_site/就是静态网站的根目录)

新建源贴:
root@AR:/usr/local/chaoxu-blog/_site# cd ..
root@AR:/usr/local/chaoxu-blog# 
root@AR:/usr/local/chaoxu-blog# cd posts
root@AR:/usr/local/chaoxu-blog/posts# nano 2016-08-20-1725-test-1.md
root@AR:/usr/local/chaoxu-blog/posts# cat 2016-08-20-1725-test-1.md
---
title: 测试1
tags: misc
---

这是测试1.
root@AR:/usr/local/chaoxu-blog/posts# cd ..
root@AR:/usr/local/chaoxu-blog# ./site build

演示网站:http://cx.smt.biz.st
项目地址:https://github.com/chaoxu/blog