首先按此文http://briteming.blogspot.com/2016/07/hakyll.html安装stack,ghc和hakyll.
cd /usr/local
git clone https://github.com/mloskot/mateusz.loskot.net
cd mateusz.loskot.net
root@AR:/usr/local/mateusz.loskot.net# ls
Makefile bin hakyll.hs posts site.hs templates
README.md css pages robots.txt
root@AR:/usr/local/mateusz.loskot.net# ghc --make site.hs
这一步可能遇错,解决办法:
修改site.hs文件如下:
删除此行:
import System.Locale (defaultTimeLocale)
加上此行:
import Data.Time.Format (formatTime, defaultTimeLocale)
root@AR:/usr/local/mateusz.loskot.net# ghc --make site.hs
root@AR:/usr/local/mateusz.loskot.net# ls
Makefile bin hakyll.hs posts site site.hs templates
README.md css pages robots.txt site.hi site.o
root@AR:/usr/local/mateusz.loskot.net# ./site rebuild
(如果遇错,则替提示出错的源帖的title的值加上英文单引号或双引号)
root@AR:/usr/local/mateusz.loskot.net# ls
Makefile _cache bin hakyll.hs posts site site.hs templates
README.md _site css pages robots.txt site.hi site.o
root@AR:/usr/local/mateusz.loskot.net# cd _site
root@AR:/usr/local/mateusz.loskot.net/_site# ls
css index.html posts posts.html
root@AR:/usr/local/mateusz.loskot.net/_site#
(可见 /usr/local/mateusz.loskot.net/_site就是静态网站的根目录)
新建源帖:
root@AR:/usr/local/mateusz.loskot.net/_site# cd ../posts
root@AR:/usr/local/mateusz.loskot.net/posts#
root@AR:/usr/local/mateusz.loskot.net/posts# ls
2005 2006 2007 2008 2009 2010 2011 2012 2013 drafts
root@AR:/usr/local/mateusz.loskot.net/posts# mkdir 2017/01/21/
root@AR:/usr/local/mateusz.loskot.net/posts/2017/01/21# mkdir test-1
root@AR:/usr/local/mateusz.loskot.net/posts/2017/01/21# cd test-1
root@AR:/usr/local/mateusz.loskot.net/posts/2017/01/21/test-1# nano index.markdown
root@AR:/usr/local/mateusz.loskot.net/posts/2017/01/21/test-1# cat index.markdown
---
date: 2017-01-21T09:09:00Z
title: 测试1
description: abc
category: test
tags: misc1, misc2, misc3
---
这是测试1.
看看如何?
root@AR:/usr/local/mateusz.loskot.net/posts/2017/01/21/test-1# cd /usr/local/mateusz.loskot.net
root@AR:/usr/local/mateusz.loskot.net# ./site rebuild
演示网站:http://ml.bright.biz.st
项目地址:https://github.com/mloskot/mateusz.loskot.net
cd /usr/local
git clone https://github.com/mloskot/mateusz.loskot.net
cd mateusz.loskot.net
root@AR:/usr/local/mateusz.loskot.net# ls
Makefile bin hakyll.hs posts site.hs templates
README.md css pages robots.txt
root@AR:/usr/local/mateusz.loskot.net# ghc --make site.hs
这一步可能遇错,解决办法:
修改site.hs文件如下:
删除此行:
import System.Locale (defaultTimeLocale)
加上此行:
import Data.Time.Format (formatTime, defaultTimeLocale)
root@AR:/usr/local/mateusz.loskot.net# ghc --make site.hs
root@AR:/usr/local/mateusz.loskot.net# ls
Makefile bin hakyll.hs posts site site.hs templates
README.md css pages robots.txt site.hi site.o
root@AR:/usr/local/mateusz.loskot.net# ./site rebuild
(如果遇错,则替提示出错的源帖的title的值加上英文单引号或双引号)
root@AR:/usr/local/mateusz.loskot.net# ls
Makefile _cache bin hakyll.hs posts site site.hs templates
README.md _site css pages robots.txt site.hi site.o
root@AR:/usr/local/mateusz.loskot.net# cd _site
root@AR:/usr/local/mateusz.loskot.net/_site# ls
css index.html posts posts.html
root@AR:/usr/local/mateusz.loskot.net/_site#
(可见 /usr/local/mateusz.loskot.net/_site就是静态网站的根目录)
新建源帖:
root@AR:/usr/local/mateusz.loskot.net/_site# cd ../posts
root@AR:/usr/local/mateusz.loskot.net/posts#
root@AR:/usr/local/mateusz.loskot.net/posts# ls
2005 2006 2007 2008 2009 2010 2011 2012 2013 drafts
root@AR:/usr/local/mateusz.loskot.net/posts# mkdir 2017/01/21/
root@AR:/usr/local/mateusz.loskot.net/posts/2017/01/21# mkdir test-1
root@AR:/usr/local/mateusz.loskot.net/posts/2017/01/21# cd test-1
root@AR:/usr/local/mateusz.loskot.net/posts/2017/01/21/test-1# nano index.markdown
root@AR:/usr/local/mateusz.loskot.net/posts/2017/01/21/test-1# cat index.markdown
---
date: 2017-01-21T09:09:00Z
title: 测试1
description: abc
category: test
tags: misc1, misc2, misc3
---
这是测试1.
看看如何?
root@AR:/usr/local/mateusz.loskot.net/posts/2017/01/21/test-1# cd /usr/local/mateusz.loskot.net
root@AR:/usr/local/mateusz.loskot.net# ./site rebuild
演示网站:http://ml.bright.biz.st
项目地址:https://github.com/mloskot/mateusz.loskot.net
No comments:
Post a Comment