Total Pageviews

Friday, 11 November 2016

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

首先按此文首先按此文http://briteming.blogspot.com/2016/07/hakyll.html安装stack,ghc和hakyll.

cd /usr/local
git clone https://github.com/ruHaskell/ruhaskell ruhaskell-site
cd ruhaskell-site
stack setup --resolver ghc-7.10.3 (安装ghc的7.10.3版)
stack build
会显示
...
Installing executable(s) in

  /usr/local/ruhaskell-site/.stack-work/install/i386-linux/lts-6.17/7.10.3/bin
...

root@AR:/usr/local/ruhaskell-site# cd .stack-work/install/i386-linux/lts-6.17/7.10.3/bin
root@AR:/usr/local/ruhaskell-site/.stack-work/install/i386-linux/lts-6.17/7.10.3/bin# mv ruHaskell ruhaskell
root@AR:/usr/local/ruhaskell-site/.stack-work/install/i386-linux/lts-6.17/7.10.3/bin# cd 
/usr/local/ruhaskell-site
root@AR:/usr/local/ruhaskell-site# .stack-work/install/i386-linux/lts-6.17/7.10.3/bin/ruhaskell build (此即生成/更新静态网站的根目录的命令)
root@AR:/usr/local/ruhaskell-site# ls
_cache   just_build.sh  ruHaskell.cabal  src       Vagrantfile
CNAME   LICENSE   Setup.hs   stack.yaml  watch.sh
deploy.sh  posts   shell.nix   static      withHakyll_build.sh
files   README.md   _site   templates
(生成了_site目录)
root@AR:/usr/local/ruhaskell-site# cd _site
root@AR:/usr/local/ruhaskell-site/_site# ls
archive.html  categories.html  index.html posts     tags
authors       CNAME       itunes-feed.xml README.md    tags.html
authors.html  feed.xml       links.html sitemap.xml
categories    files       maillist.html static
root@AR:/usr/local/ruhaskell-site/_site#
(可见/usr/local/ruhaskell-site/_site就是静态网站的根目录)

新建源帖:
root@AR:/usr/local/ruhaskell-site/_site# cd ..
root@AR:/usr/local/ruhaskell-site# 
root@AR:/usr/local/ruhaskell-site# cd posts
root@AR:/usr/local/ruhaskell-site/posts# ls
algorithms  dynamic  events  numeric   projects  tasks typesystem  web
cast     elm      gui     packages  talks theory  utils
root@AR:/usr/local/ruhaskell-site/posts# cd talks
root@AR:/usr/local/ruhaskell-site/posts/talks# nano 2016-11-12-test-1.md
root@AR:/usr/local/ruhaskell-site/posts/talks# cat 2016-11-12-test-1.md
---
author: brite fisher
title: 测试1
tags: misc1, misc2, misc3
description: abc
---

这是测试1.
root@AR:/usr/local/ruhaskell-site/posts/talks# cd ../..
root@AR:/usr/local/ruhaskell-site# .stack-work/install/i386-linux/lts-6.17/7.10.3/bin/ruhaskell build

演示网站:http://rh.bright.biz.st
项目地址:https://github.com/ruHaskell/ruhaskell