Total Pageviews

Wednesday 24 August 2016

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

先安装ghc.

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


root@AR:/usr/local/lettier.github.io# ls
build_deploy.hs  lettier-github-io.cabal templates 
_cache posts   stack.yaml
css  lettier_blog.hs  README.md   
images readme_preview.jpg

root@AR:/usr/local/lettier.github.io# ghc --make lettier_blog.hs
root@AR:/usr/local/lettier.github.io# ls
build_deploy.hs  lettier_blog   lettier-github-io.cabal  templates
_cache lettier_blog.hi  posts   stack.yaml
css lettier_blog.hs  README.md   
images lettier_blog.o   readme_preview.jpg
(生成了可执行文件lettier_blog)
root@AR:/usr/local/lettier.github.io# ./lettier_blog build
root@AR:/usr/local/lettier.github.io# ls
build_deploy.hs  lettier_blog   lettier-github-io.cabal  _site
_cache lettier_blog.hi  posts   stack.yaml
css lettier_blog.hs  README.md   templates
images lettier_blog.o   readme_preview.jpg
root@AR:/usr/local/lettier.github.io# cd _site
root@AR:/usr/local/lettier.github.io/_site# ls
css  images index.html posts posts.html
root@AR:/usr/local/lettier.github.io/_site# 
(可见/usr/local/lettier.github.io/_site/就是静态网站的根目录)

新建源贴:
root@AR:/usr/local/lettier.github.io/_site# cd ..
root@AR:/usr/local/lettier.github.io# cd posts
root@AR:/usr/local/lettier.github.io/posts# nano 2016-08-24-1139-test-1.markdown
root@AR:/usr/local/lettier.github.io/posts# cat 2016-08-24-1139-test-1.markdown
---
title: 测试1
description: xyz
author: brite
---

这是测试1.
(注意:源贴的顶部的那些值里不能有":", "-"这样的标点符号。如果有,请把值用引号包起来。)
root@AR:/usr/local/lettier.github.io/posts# cd ..
root@AR:/usr/local/lettier.github.io# ./lettier_blog build

演示网站:http://lte.smt.biz.st,http://lte.smt.biz.st/posts.html
项目地址:https://github.com/lettier/lettier.github.io