Total Pageviews

Monday 23 January 2017

搭建基于haskell的静态博客程序shakthimaan-blog(支持分页)

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

cd /usr/local
mkdir shakthimaan-blog-hakyll4
cd shakthimaan-blog-hakyll4
wget https://github.com/shakthimaan/shakthimaan-blog/archive/hakyll-4.zip
unzip hakyll-4.zip

root@AR:/usr/local/shakthimaan-blog-hakyll4# ls
hakyll-4.zip  shakthimaan-blog-hakyll-4
root@AR:/usr/local/shakthimaan-blog-hakyll4# rm hakyll-4.zip
root@AR:/usr/local/shakthimaan-blog-hakyll4# cd shakthimaan-blog-hakyll-4
root@AR:/usr/local/shakthimaan-blog-hakyll4/shakthimaan-blog-hakyll-4# stack build
会显示:
...
Linking .stack-work/dist/i386-linux/Cabal-1.24.0.0/build/blog/blog ...
blog-0.1.0.0: copy/register
Installing executable(s) in
/usr/local/shakthimaan-blog-hakyll4/shakthimaan-blog-hakyll-4/.stack-work/install/i386-linux/nightly-2016-12-22/8.0.1/bin
Completed 7 action(s).
root@AR:/usr/local/shakthimaan-blog-hakyll4/shakthimaan-blog-hakyll-4# .stack-work/install/i386-linux/nightly-2016-12-22/8.0.1/bin/blog build (此即生成/更新静态网站的根目录的命令)
root@AR:/usr/local/shakthimaan-blog-hakyll4/shakthimaan-blog-hakyll-4# ls
Makefile  README.markdown  _site  css  posts    stack.yaml  templates
README      _cache       build  js   scripts    static
root@AR:/usr/local/shakthimaan-blog-hakyll4/shakthimaan-blog-hakyll-4# cd _site
root@AR:/usr/local/shakthimaan-blog-hakyll4/shakthimaan-blog-hakyll-4/_site# ls
blog                      haskell-fft-index.html
css                      haskell-rss.xml
data-visualisation.html              index.html
dv                      js
favicon.ico                  misc-images
favicon.png                  programming-bio.html
files                      rss.xml
gui-programming.html              thesis
haskell-data-analysis-ao1-index.html  web-apps.html
root@AR:/usr/local/shakthimaan-blog-hakyll4/shakthimaan-blog-hakyll-4/_site#
(可见/usr/local/shakthimaan-blog-hakyll4/shakthimaan-blog-hakyll-4/_site就是静态网站的根目录)

新建源帖:
root@AR:/usr/local/shakthimaan-blog-hakyll4/shakthimaan-blog-hakyll-4/_site# cd ../posts
root@AR:/usr/local/shakthimaan-blog-hakyll4/shakthimaan-blog-hakyll-4/posts# ls
2005  2006  2007  2008    2009  2010  2011  2012    2013  2014  2015  2016
root@AR:/usr/local/shakthimaan-blog-hakyll4/shakthimaan-blog-hakyll-4/posts# mkdir -p 2017/01/24
root@AR:/usr/local/shakthimaan-blog-hakyll4/shakthimaan-blog-hakyll-4/posts# cd 2017/01/24
root@AR:/usr/local/shakthimaan-blog-hakyll4/shakthimaan-blog-hakyll-4/posts/2017/01/24# mkdir test-1
root@AR:/usr/local/shakthimaan-blog-hakyll4/shakthimaan-blog-hakyll-4/posts/2017/01/24# cd test-1
root@AR:/usr/local/shakthimaan-blog-hakyll4/shakthimaan-blog-hakyll-4/posts/2017/01/24/test-1# nano text.markdown
(根据/usr/local/shakthimaan-blog-hakyll4/shakthimaan-blog-hakyll-4/posts/2016/12/28/emacs-calendar-macros-drawing/text.markdown文件的格式)
root@AR:/usr/local/shakthimaan-blog-hakyll4/shakthimaan-blog-hakyll-4/posts/2017/01/24/test-1# cat text.markdown
---
author: brite fisherman
tags: misc1, misc2, misc3
published: 2017-01-24 11:08:00
title: 测试1
---


这是测试1.


<!--MORE-->

看看如何?
root@AR:/usr/local/shakthimaan-blog-hakyll4/shakthimaan-blog-hakyll-4/posts/2017/01/24/test-1# cd  /usr/local/shakthimaan-blog-hakyll4/shakthimaan-blog-hakyll-4
root@AR:/usr/local/shakthimaan-blog-hakyll4/shakthimaan-blog-hakyll-4#
.stack-work/install/i386-linux/nightly-2016-12-22/8.0.1/bin/blog rebuild
root@AR:/usr/local/shakthimaan-blog-hakyll4/shakthimaan-blog-hakyll-4#

演示网站:http://stm.bright.biz.st,http://stm.bright.biz.st/blog/
项目地址:https://github.com/shakthimaan/shakthimaan-blog/tree/hakyll-4
https://github.com/shakthimaan/shakthimaan-blog/archive/hakyll-4.zip
这个程序的源码修改自ian-ross-blog: https://github.com/ian-ross/blog/,
相关帖子:http://briteming.blogspot.com/2016/12/haskellian-ross-blog.html

No comments:

Post a Comment