Total Pageviews

Saturday, 7 January 2017

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

先按此文http://briteming.blogspot.com/2016/07/hakyll.html,搭建stack,ghc,

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

root@AR:/usr/local/eliza0x.github.io# ls
Blog.cabal  LICENSE  design  images  src        templates
CNAME        css    files   posts   stack.yaml    top_pages
root@AR:/usr/local/eliza0x.github.io# stack build
会显示:
...
Linking .stack-work/dist/i386-linux/Cabal-1.24.0.0/build/site/site ...
Blog-0.1.0.0: copy/register
Installing executable(s) in
/usr/local/eliza0x.github.io/.stack-work/install/i386-linux/lts-7.7/8.0.1/bin
Completed 137 action(s).
root@AR:/usr/local/eliza0x.github.io# .stack-work/dist/i386-linux/Cabal-1.24.0.0/build/site/site build  (此即生成/更新静态网站的根目录的命令)
root@AR:/usr/local/eliza0x.github.io# ls
Blog.cabal  LICENSE  _site  design  images  src        templates
CNAME        _cache   css    files   posts   stack.yaml    top_pages
root@AR:/usr/local/eliza0x.github.io# cd _site
root@AR:/usr/local/eliza0x.github.io/_site# ls
404.html  about.html  archive.html  css    images      posts          rss.xml
CNAME      archive     contact.html  files  index.html  products.html  tags
root@AR:/usr/local/eliza0x.github.io/_site#
(可见/usr/local/eliza0x.github.io/_site就是静态网站的根目录)

新建源帖:
root@AR:/usr/local/eliza0x.github.io/_site# cd ../posts
root@AR:/usr/local/eliza0x.github.io/posts# nano  2017-01-08-test-1.md
root@AR:/usr/local/eliza0x.github.io/posts# cat 2017-01-08-test-1.md
----
title: 测试1
description: abc
date: 2017-01-08
tags: misc1, misc2, misc3
----

这是测试1.

<!--more-->

看看如何呢?

root@AR:/usr/local/eliza0x.github.io/posts#
(注意:上面的<!--more-->部分一定要加上,否则下面build时,会遇错:
[ERROR] Missing field $teaser$  )
root@AR:/usr/local/eliza0x.github.io/posts# cd ..
root@AR:/usr/local/eliza0x.github.io# .stack-work/dist/i386-linux/Cabal-1.24.0.0/build/site/site build

演示网站:http://elz.bright.biz.st/, http://elz.bright.biz.st/archive.html(此页面里提供了分页功能)
项目地址:https://github.com/eliza0x/eliza0x.github.io
这个项目是日本一位17岁的中学生的作品。这小子牛逼。