Pages

Saturday, 1 October 2016

搭建基于hakyll的静态博客程序“blog.coldflake”

按此文http://briteming.blogspot.com/2016/07/hakyll.html安装hakyll.

git clone https://github.com/marcmo/blog.coldflake /usr/local/blog.coldflake
cd /usr/local/blog.coldflake

root@AR:/usr/local/blog.coldflake# ls
404.html   default.nix   images     README.md todo.txt
about.md   coldflake.hs  fonts       js     run_mincss
Gemfile       optional.rb  
code   colophon.md Gemfile.lock  posts     templates
css Guardfile     rakefile.rb  test.html

root@AR:/usr/local/blog.coldflake# ghc --make coldflake.hs
root@AR:/usr/local/blog.coldflake# ls
404.html   coldflake.hi  default.nix   images     README.md todo.txt
about.md   coldflake.hs  fonts       js     run_mincss
_cache   coldflake.o Gemfile       optional.rb  
code   colophon.md Gemfile.lock  posts     templates
coldflake  css Guardfile     rakefile.rb  test.html
(这一步命令生成了可执行文件coldflake)
root@AR:/usr/local/blog.coldflake# ./coldflake build
(这就是生成静态网站的根目录的命令)
root@AR:/usr/local/blog.coldflake# ls
404.html   coldflake.hi  default.nix   images     README.md todo.txt
about.md   coldflake.hs  fonts       js     run_mincss
_cache   coldflake.o Gemfile       optional.rb  _site
code   colophon.md Gemfile.lock  posts     templates
coldflake  css Guardfile     rakefile.rb  test.html
(生成了_site目录)
root@AR:/usr/local/blog.coldflake# cd _site
root@AR:/usr/local/blog.coldflake/_site# ls
404.html    atom.xml  css    images js posts.html  tags
about.html  code      fonts  index.html  posts rss.xml     test.html
root@AR:/usr/local/blog.coldflake/_site# 
(可见/usr/local/blog.coldflake/_site/就是静态网站的根目录)

新建源贴:
root@AR:/usr/local/blog.coldflake/_site# cd ../posts
root@AR:/usr/local/blog.coldflake/posts# nano 2016-10-02-test-1.md
root@AR:/usr/local/blog.coldflake/posts# cat 2016-10-02-test-1.md
---
title: 测试1
description: 点击标题,看全文
tags: misc1, misc2, misc3
---

这是测试1.
root@AR:/usr/local/blog.coldflake/posts# cd ..
root@AR:/usr/local/blog.coldflake# ./coldflake build

演示网站:http://cf.bright.biz.st/
项目地址:https://github.com/marcmo/blog.coldflake