Total Pageviews

Sunday, 29 January 2017

搭建基于haskell的静态博客程序dmjio


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

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

root@AR:/usr/local/dmj.io# ghc --make site.hs
root@AR:/usr/local/dmj.io# ./site build
root@AR:/usr/local/dmj.io# cd _site
root@AR:/usr/local/dmj.io/_site# ls
archive.html  atom.xml    css  images  index.html  posts    tags
root@AR:/usr/local/dmj.io/_site#
(可见/usr/local/dmj.io/_site就是静态网站的根目录)

新建源帖:
root@AR:/usr/local/dmj.io/_site# cd ../posts
root@AR:/usr/local/dmj.io/posts# nano 2017-01-29-test-1.markdown
root@AR:/usr/local/dmj.io/posts# cat 2017-01-29-test-1.markdown
---
title: 测试1
author: brite fisherman
tags: misc1, misc2, misc3
---

这是测试1.

<!--more-->

看看如何?

root@AR:/usr/local/dmj.io/posts# cd ..
root@AR:/usr/local/dmj.io# ./site build
不过,帖子发表后,中文帖子会有乱码。解决办法:
root@AR:/usr/local/dmj.io# cd templates
root@AR:/usr/local/dmj.io/templates# nano default.html
在default.html文件的第5行的上方加上一行:
<meta charset=utf-8>
然后:
root@AR:/usr/local/dmj.io/templates# cd ..
root@AR:/usr/local/dmj.io# ./site rebuild

演示网站:http://di.bright.biz.st/
项目地址:https://github.com/dmjio/dmjio
https://github.com/dmjio/dmjio/issues/1

No comments:

Post a Comment