Total Pageviews

Thursday 26 January 2017

搭建基于haskell的静态博客程序tanakh.jp

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

cd /usr/local

git clone  https://github.com/tanakh/tanakh.jp

cd tanakh.jp

root@AR:/usr/local/tanakh.jp# ls
CNAME    about.md    deploy.hs     index.html  pub      
contact.md  favicon.ico  js         pub.md  emplates
css        img         posts         robots.txt  site.hs  tools
root@AR:/usr/local/tanakh.jp#  ghc --make site.hs
root@AR:/usr/local/tanakh.jp# ./site build
会遇错:
...
[ERROR] Missing field $posts$ in context for item archive.html
解决办法:
root@AR:/usr/local/tanakh.jp# find . -name archive.html
./templates/archive.html
root@AR:/usr/local/tanakh.jp# nano
./templates/archive.html
root@AR:/usr/local/tanakh.jp# cat ./templates/archive.html
<h2>$title$</h2>

$posts$
(即去掉https://raw.githubusercontent.com/tanakh/tanakh.jp/master/templates/archive.html文件中的
<ul>和</ul> )
root@AR:/usr/local/tanakh.jp# ./site build (此次未再遇错)
root@AR:/usr/local/tanakh.jp# cd _site
root@AR:/usr/local/tanakh.jp/_site# ls
CNAME          contact.html  img        posts      robots.txt  tools.html
about.html    css        index.html    pub      tags
archive.html  favicon.ico   js        pub.html  tools
root@AR:/usr/local/tanakh.jp/_site#
(可见/usr/local/tanakh.jp/_site就是静态网站的根目录)
新建源帖:
root@AR:/usr/local/tanakh.jp/_site# cd ../posts
root@AR:/usr/local/tanakh.jp/posts# nano 2017-01-27-test-1.md
root@AR:/usr/local/tanakh.jp/posts# cat 2017-01-27-test-1.md
---
title: 测试1
description: 点击标题看全文
tags: misc1, misc2, misc3
---

这是测试1.

root@AR:/usr/local/tanakh.jp/posts# cd ..
root@AR:/usr/local/tanakh.jp# ./site rebuild
演示网站:http://tnj.bright.biz.st/
项目地址:https://github.com/tanakh/tanakh.jp
相关帖子:http://briteming.blogspot.jp/2016/08/hakyllsadhencomxinitrcde.html

No comments:

Post a Comment