Total Pageviews

Thursday 25 August 2016

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

先安装ghc,cabal和stack.

cd /usr/local
git clone https://github.com/sakshamsharma/acehack acehack.org
cd acehack.org

root@AR:/usr/local/acehack.org# ls
about.md       cabal.sandbox.config  deploy_key.enc  posts stack.yaml
acehack.cabal  _cache     deploy.sh     README.md templates
assets       CNAME     index.html      site.hs
build.sh       contact.md     LICENSE
(这里运行ghc --make site.hs来安装会遇错。运行cabal sandbox init && cabal install来安装也会遇错。运行stack build,则能成功安装。以后安装基于haskell的程序时,都按此顺序进行。)     

root@AR:/usr/local/acehack.org# stack build
会显示:
...
Linking .stack-work/dist/i386-linux/Cabal-1.22.5.0/build/site/site ...
acehack-3.0.0.0: copy/register
Installing executable(s) in
/usr/local/acehack.org/.stack-work/install/i386-linux/lts-5.17/7.10.3/bin
Completed 50 action(s).
root@AR:/usr/local/acehack.org# .stack-work/dist/i386-linux/Cabal-1.22.5.0/build/site/site build 
(此即生成/更新静态网站的命令。运行 .stack-work/install/i386-linux/lts-5.17/7.10.3/bin/site build也行。)
root@AR:/usr/local/acehack.org# ls
about.md       cabal.sandbox.config  deploy_key.enc  posts stack.yaml
acehack.cabal  _cache     deploy.sh     README.md templates
assets       CNAME     index.html      _site
build.sh       contact.md     LICENSE     site.hs
root@AR:/usr/local/acehack.org# cd _site
root@AR:/usr/local/acehack.org/_site# ls
about.html    categories  contact.html images     js   sitemap.xml
archive.html  CNAME   css index.html  posts  tags
root@AR:/usr/local/acehack.org/_site#
(可见/usr/local/acehack.org/_site/就是静态网站的根目录)

新建源贴:
root@AR:/usr/local/acehack.org/_site# cd ..
root@AR:/usr/local/acehack.org# ls
about.md       cabal.sandbox.config  deploy_key.enc  posts stack.yaml
acehack.cabal  _cache     deploy.sh     README.md templates
assets       CNAME     index.html      _site
build.sh       contact.md     LICENSE     site.hs
root@AR:/usr/local/acehack.org# cd posts
root@AR:/usr/local/acehack.org/posts# 
root@AR:/usr/local/acehack.org/posts# ls
2015-06-15-vim.markdown   
root@AR:/usr/local/acehack.org/posts# nano 2016-08-25-1433-test-1.markdown 
root@AR:/usr/local/acehack.org/posts# cat 2016-08-25-1433-test-1.markdown 
---
title: 测试1
technical: true
summary: 摘要
tags: testing1, testing2, testing3
category: tutorial
author: brite
---

这是测试1. 
root@AR:/usr/local/acehack.org/posts# cd ..
root@AR:/usr/local/acehack.org# .stack-work/dist/i386-linux/Cabal-1.22.5.0/build/site/site build

演示网站:http://surmount.biz.st:7327,http://surmount.biz.st:7327/archive.html
http://ah.smt.biz.st,http://ah.smt.biz.st/archive.html
项目地址:https://github.com/sakshamsharma/acehack/