Total Pageviews

Saturday 15 October 2016

搭建基于hakyll的静态博客程序-“co-dan website”

先按此文http://briteming.blogspot.com/2016/07/hakyll.html的蓝色字部分安装stack.

cd /usr/local/
mkdir covariant.me
cd covariant.me
wget http://hub.darcs.net/co-dan/website/dist
mv dist dist.zip
unzip dist.zip

root@AR:/usr/local/covariant.me# ls
website dist.zip

root@AR:/usr/local/covariant.me# cd website 
root@AR:/usr/local/covariant.me/website# ls
_cache images LICENSE  postamble.tex  templates
css js notes   preamble.tex site.hs     website.cabal
fonts key.txt  pages   README.md stack.yaml
root@AR:/usr/local/covariant.me/website# stack build
会显示:
...
Linking .stack-work/dist/i386-linux/Cabal-1.22.5.0/build/website/website ...
website-1: copy/register
./website.cabal has been changed. Re-configuring with most recently used
options. If this fails, please run configure manually.
Configuring website-1...
Installing executable(s) in
/usr/local/covariant.me/website/.stack-work/install/i386-linux/lts-6.6/7.10.3/bin
...
root@AR:/usr/local/covariant.me/website# .stack-work/dist/i386-linux/Cabal-1.22.5.0/build/website/website build (这个就是生成静态网站的根目录的命令)
root@AR:/usr/local/covariant.me/website# ls
_cache images LICENSE  postamble.tex  _site     templates
css js notes   preamble.tex site.hs     website.cabal
fonts key.txt  pages   README.md stack.yaml
root@AR:/usr/local/covariant.me/website# cd _site
root@AR:/usr/local/covariant.me/website/_site# ls
css    fonts   index.html  key.txt     notes
draft  images  js   links.html  pdfs.html
root@AR:/usr/local/covariant.me/website/_site# 
(可见/usr/local/covariant.me/website/_site就是静态网站的根目录)

新建源贴:
root@AR:/usr/local/covariant.me/website/_site# cd ..
root@AR:/usr/local/covariant.me/website# ls
_cache images LICENSE  postamble.tex  _site     templates
css js notes   preamble.tex site.hs     website.cabal
fonts key.txt  pages   README.md stack.yaml
root@AR:/usr/local/covariant.me/website# cd notes
root@AR:/usr/local/covariant.me/website/notes# nano test-1.md
root@AR:/usr/local/covariant.me/website/notes# cat test-1.md
---
title: 测试1
tags: misc1, misc2, misc3
date: 2016-10-15
...

这是测试1.
root@AR:/usr/local/covariant.me/website/notes# cd ..
root@AR:/usr/local/covariant.me/website# .stack-work/dist/i386-linux/Cabal-
1.22.5.0/build/website/website build

演示网站:http://cv.bright.biz.st,http://cv.bright.biz.st/notes/
项目地址:http://hub.darcs.net/co-dan/website