Total Pageviews

Tuesday 7 February 2017

搭建基于haskell的静态博客程序d12frosted.io

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

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


root@AR:/usr/local/d12frosted.io# stack build 
会显示:
...
Linking .stack-work/dist/i386-linux/Cabal-1.22.5.0/build/hakyll-init/hakyll-init ...
Installing library in
/usr/local/d12frosted.io/.stack-work/install/i386-linux/lts-5.11/7.10.3/lib/i386-linux-ghc-7.10.3/hakyll-4.7.5.2-JBpvkQ5zGUk8hBuszcLww0
Installing executable(s) in
/usr/local/d12frosted.io/.stack-work/install/i386-linux/lts-5.11/7.10.3/bin
Registering hakyll-4.7.5.2...

--  End of log file: /usr/local/d12frosted.io/.stack-work/logs/hakyll-4.7.5.2.log

Log files have been written to: /usr/local/d12frosted.io/.stack-work/logs/
root@AR:/usr/local/d12frosted.io#
root@AR:/usr/local/d12frosted.io# ls .stack-work/install/i386-linux/lts-5.11/7.10.3/bin
d12frosted-io  hakyll-init
root@AR:/usr/local/d12frosted.io# .stack-work/install/i386-linux/lts-5.11/7.10.3/bin/d12frosted-io build (此即生成/更新静态网站的根目录的命令。会在当前目录下生成_site目录)
root@AR:/usr/local/d12frosted.io# cd _site
root@AR:/usr/local/d12frosted.io/_site# ls
CNAME  blog  blog.html css  fonts  images  index.html
root@AR:/usr/local/d12frosted.io/_site# 
(可见/usr/local/d12frosted.io/_site就是静态网站的根目录)

新建源帖:
root@AR:/usr/local/d12frosted.io/_site# cd ../blog/posts
root@AR:/usr/local/d12frosted.io/blog/posts# nano test-1.md
root@AR:/usr/local/d12frosted.io/blog/posts# cat test-1.md
---
title: 测试1
date: 2017-02-07 15:46:00
---

这是测试1.

看看如何?
root@AR:/usr/local/d12frosted.io/blog/posts# cd ../..
root@AR:/usr/local/d12frosted.io# .stack-work/install/i386-linux/lts-5.11/7.10.3/bin/d12frosted-io rebuild

演示网站:http://dfi.bright.biz.st/, http://dfi.bright.biz.st/blog.html
项目地址:https://github.com/d12frosted/d12frosted.io

No comments:

Post a Comment