Pages

Wednesday, 18 January 2017

搭建基于haskell的静态博客程序gwern.net

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

cd /usr/local
git clone https://github.com/gwern/gwern.net
cd gwern.net

root@AR:/usr/local/gwern.net# cabal install filestore
root@AR:/usr/local/gwern.net# cabal install feed
root@AR:/usr/local/gwern.net# ghc --make hakyll.hs(此步骤会生成可执行文件hakyll)
root@AR:/usr/local/gwern.net# ./hakyll build (此即生成/更新静态网站的根目录的命令。会在当前目录下生成_site目录)
root@AR:/usr/local/gwern.net# cd _site
root@AR:/usr/local/gwern.net/_site# rm index.html
root@AR:/usr/local/gwern.net/_site# mv index index.html
(可见/usr/local/gwern.net/_site就是静态网站的根目录)

 新建源贴:
root@AR:/usr/local/gwern.net/_site# cd ..
root@AR:/usr/local/gwern.net# nano test-1.page
root@AR:/usr/local/gwern.net# cat test-1.page
---
title: 测试1
description: 这是测试。。。
tags: misc1, misc2, misc3
created: 19 January 2017
status: finished
belief: log
...

这是测试1.

看看如何?

root@AR:/usr/local/gwern.net# ./hakyll build

演示网站:http://gn.bright.biz.st/
(不过发表的帖子并未自动显示在首页。
http://gn.bright.biz.st/test-1
http://gn.bright.biz.st/test-2
http://gn.bright.biz.st/chinese-economy
http://gn.bright.biz.st/bcoz-i-love-u)
项目地址:https://github.com/gwern/gwern.net/
https://github.com/gwern/gwern.net/issues/10

No comments:

Post a Comment