Pages

Monday, 20 February 2017

搭建基于haskell的静态博客程序hrothen.github.com

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

cd /usr/local
git clone --branch hakyll https://github.com/Hrothen/hrothen.github.com
cd hrothen.github.com

root@AR:/usr/local/hrothen.github.com#  stack build
会显示:
Linking .stack-work/dist/i386-linux/Cabal-1.18.1.5/build/site/site ...
blog-0.1.0.0: copy/register
Installing executable(s) in
/usr/local/hrothen.github.com/.stack-work/install/i386-linux/lts-2.22/7.8.4/bin
Completed 37 action(s).
root@AR:/usr/local/hrothen.github.com#
.stack-work/dist/i386-linux/Cabal-1.18.1.5/build/site/site build
root@AR:/usr/local/hrothen.github.com# ls
404.html   TODO    about.html     css        post.hs  stack.yaml
LICENSE    _cache  blog.cabal     deploy.sh  posts    templates
README.md  _site   changelog.md  fonts        site.hs
root@AR:/usr/local/hrothen.github.com# cd _site

root@AR:/usr/local/hrothen.github.com/_site# ls
2013  2015      archive.html    css    index.html
2014  about.html  atom.xml    fonts  posts
root@AR:/usr/local/hrothen.github.com/_site# 

(可见/usr/local/hrothen.github.com/_site就是静态网站的根目录)

新建源帖:
root@AR:/usr/local/hrothen.github.com/_site# cd ../posts
root@AR:/usr/local/hrothen.github.com/posts# nano 2017-02-16-test-1.md
root@AR:/usr/local/hrothen.github.com/posts# cat 2017-02-16-test-1.md
---
title: 测试1
description: 点击标题,看全文
---

这是测试1.

看看如何?

root@AR:/usr/local/hrothen.github.com/posts#  cd ..

root@AR:/usr/local/hrothen.github.com# .stack-work/dist/i386-linux/Cabal-1.18.1.5/build/site/site rebuild

演示网站:http://hgc.bright.biz.st/
项目地址:https://github.com/Hrothen/hrothen.github.com/tree/hakyll

No comments:

Post a Comment