Total Pageviews

Saturday, 1 October 2016

搭建基于hakyll的静态博客程序benjeffrey.com

先安装ruby环境,nodejs环境。
然后
gem install sass compass
npm install -g bower
按此文http://briteming.blogspot.com/2016/07/hakyll.html安装hakyll.
git clone https://github.com/jeffbr13/benjeffrey.com /usr/local/benjeffrey.com
cd  /usr/local/benjeffrey.com
bower install --allow-root

root@AR:/usr/local/benjeffrey.com# ls
benjeffrey-com.cabal  bower.json  content  posts      Setup.hs src
_cache   LICENSE  README.md  templates
root@AR:/usr/local/benjeffrey.com# cd src
root@AR:/usr/local/benjeffrey.com/src# ls
_cache config.rb  deploy.sh  nginx.conf  scss site.hs
root@AR:/usr/local/benjeffrey.com/src# ghc --make site.hs
(此命令会在当前目录下,生成可执行文件site)
root@AR:/usr/local/benjeffrey.com/src# ls
_cache config.rb  deploy.sh  nginx.conf  scss site  site.hi  site.hs site.o
root@AR:/usr/local/benjeffrey.com/src# cd ..
root@AR:/usr/local/benjeffrey.com# ls
benjeffrey-com.cabal  bower.json  content  posts      Setup.hs src
bower_components      _cache   LICENSE  README.md  templates
root@AR:/usr/local/benjeffrey.com# ./src/site build
(此即为生成静态网站的根目录的命令,会在当前目录下,生成_site目录)
root@AR:/usr/local/benjeffrey.com# ls
benjeffrey-com.cabal  bower.json  content  posts      Setup.hs src
bower_components      _cache   LICENSE  README.md  _site templates
root@AR:/usr/local/benjeffrey.com# cd _site
root@AR:/usr/local/benjeffrey.com/_site# ls
cv     fonts   index.html       posts   robots.txt
favicon.ico  images  mail@benjeffrey.com.asc  profile.jpg  vCard.vcf
root@AR:/usr/local/benjeffrey.com/_site#
(可见/usr/local/benjeffrey.com/_site/就是静态网站的根目录。)

发布新帖:
root@AR:/usr/local/benjeffrey.com/_site# cd ../posts
root@AR:/usr/local/benjeffrey.com/posts# nano test-1.md
root@AR:/usr/local/benjeffrey.com/posts# cat test-1.md
---
title: 测试1
description: 点击标题,看全文 
date: 2016-10-02
---

这是测试1.
root@AR:/usr/local/benjeffrey.com/posts# 
root@AR:/usr/local/benjeffrey.com/posts# cd ..
root@AR:/usr/local/benjeffrey.com# ./src/site build

演示网站:http://bj.bright.biz.st
项目地址:https://github.com/jeffbr13/benjeffrey.com