Total Pageviews

Wednesday, 24 August 2016

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

先安装ghc和cabal.

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


root@AR:/usr/local/kuznero.github.io# ls
about.md       dist   fonts     templates
cabal.sandbox.config  _docker   images     scripts
config       docs   index.html     site.hs
css       drafts   kuznero-github-io.cabal  stack.yaml
cv.md       favicon.ico  posts
(这里的site.hs有问题,所以用cabal安装法)     

root@AR:/usr/local/kuznero.github.io# cabal sandbox init
root@AR:/usr/local/kuznero.github.io# cabal install
(运行完毕后,会在当前目录的子目录.cabal-sandbox/bin/下,生成可执行文件site)
root@AR:/usr/local/kuznero.github.io# .cabal-sandbox/bin/site build(此即生成/更新静态网站的命令)
root@AR:/usr/local/kuznero.github.io# ls
about.md       dist   fonts     _preview
cabal.sandbox.config  _docker   images     scripts
config       docs   index.html     site.hs
css       drafts   kuznero-github-io.cabal  stack.yaml
cv.md       favicon.ico  posts     templates
root@AR:/usr/local/kuznero.github.io# cd _preview
root@AR:/usr/local/kuznero.github.io/_preview# ls
cache  out
root@AR:/usr/local/kuznero.github.io/_preview# cd out
root@AR:/usr/local/kuznero.github.io/_preview/out# ls
about.html    cv.html  drafts     images rss.xml  tags.html
archive.html  data     favicon.ico  index.html scripts
css       docs     fonts     posts tags
root@AR:/usr/local/kuznero.github.io/_preview/out# 
(可见/usr/local/kuznero.github.io/_preview/out/就是静态网站的根目录)

新建源贴:
root@AR:/usr/local/kuznero.github.io/_preview/out# cd /usr/local/kuznero.github.io
root@AR:/usr/local/kuznero.github.io# cd posts
root@AR:/usr/local/kuznero.github.io/posts# ls
blogging  csharp  emacs  haskell  powershell  tips
root@AR:/usr/local/kuznero.github.io/posts# mkdir misc
root@AR:/usr/local/kuznero.github.io/posts# cd misc
root@AR:/usr/local/kuznero.github.io/posts/misc# nano 2016-08-25-1301-test-1.md
(按/usr/local/kuznero.github.io/posts/blogging/里的md文件的内容格式,新建源贴2016-08-25-1301-test-1.md ,内容如下:
---
title: 测试1
tags: testing1, testing2, testing3
description: xyz
category: misc
---

这是测试1.  
root@AR:/usr/local/kuznero.github.io/posts/misc# cd ../..
root@AR:/usr/local/kuznero.github.io# .cabal-sandbox/bin/site build

演示网站:http://knr.smt.biz.st,http://kuznero.github.io
项目地址:https://github.com/kuznero/kuznero.github.io