先安装stack和ghc.
cd /usr/local
git clone https://github.com/simonmar/blog simonmar-blog
cd simonmar-blog
root@AR:/usr/local/simonmar-blog# ghc --make site.hs
[1 of 1] Compiling Main ( site.hs, site.o )
Linking site ...
root@AR:/usr/local/simonmar-blog#
root@AR:/usr/local/simonmar-blog# ls
bib css index.html site site.o
blog.cabal deploy pages site.hi stack.yaml
about.rst contact.markdown images posts site.hs templates
(生成了可执行文件site)
root@AR:/usr/local/simonmar-blog# ./site rebuild
(会遇错:commitBuffer: invalid argument (invalid character)
解决办法:
root@AR:/usr/local/simonmar-blog# ./site rebuild
root@AR:/usr/local/simonmar-blog# ls
_cache bib css index.html site site.o
_site blog.cabal deploy pages site.hi stack.yaml
about.rst contact.markdown images posts site.hs templates
(生成了_site目录)
root@AR:/usr/local/simonmar-blog# cd _site
root@AR:/usr/local/simonmar-blog/_site# ls
about.html atom.xml contact.html images pages
archive.html bib css index.html posts
root@AR:/usr/local/simonmar-blog/_site#
(可见 /usr/local/simonmar-blog/_site就是静态网站的根目录)
新建源帖:
root@AR:/usr/local/simonmar-blog/_site# cd ..
root@AR:/usr/local/simonmar-blog# cd posts
root@AR:/usr/local/simonmar-blog/posts# nano 2016-12-30-test-1.md
root@AR:/usr/local/simonmar-blog/posts# cat 2016-12-30-test-1.md
---
layout: post
title: 测试1
description: ""
category: misc
tags: [misc]
---
这是测试1.
看看如何?
root@AR:/usr/local/simonmar-blog/posts# cd ..
root@AR:/usr/local/simonmar-blog#
root@AR:/usr/local/simonmar-blog# ./site rebuild
演示网站:http://smb.bright.biz.st/
项目地址:https://github.com/simonmar/blog
cd /usr/local
git clone https://github.com/simonmar/blog simonmar-blog
cd simonmar-blog
root@AR:/usr/local/simonmar-blog# ghc --make site.hs
[1 of 1] Compiling Main ( site.hs, site.o )
Linking site ...
root@AR:/usr/local/simonmar-blog#
root@AR:/usr/local/simonmar-blog# ls
bib css index.html site site.o
blog.cabal deploy pages site.hi stack.yaml
about.rst contact.markdown images posts site.hs templates
(生成了可执行文件site)
root@AR:/usr/local/simonmar-blog# ./site rebuild
(会遇错:commitBuffer: invalid argument (invalid character)
解决办法:
运行export LC_ALL=C.UTF-8即可。参见https://github.com/commercialhaskell/stack/issues/793)
root@AR:/usr/local/simonmar-blog# ./site rebuild
root@AR:/usr/local/simonmar-blog# ls
_cache bib css index.html site site.o
_site blog.cabal deploy pages site.hi stack.yaml
about.rst contact.markdown images posts site.hs templates
(生成了_site目录)
root@AR:/usr/local/simonmar-blog# cd _site
root@AR:/usr/local/simonmar-blog/_site# ls
about.html atom.xml contact.html images pages
archive.html bib css index.html posts
root@AR:/usr/local/simonmar-blog/_site#
(可见 /usr/local/simonmar-blog/_site就是静态网站的根目录)
新建源帖:
root@AR:/usr/local/simonmar-blog/_site# cd ..
root@AR:/usr/local/simonmar-blog# cd posts
root@AR:/usr/local/simonmar-blog/posts# nano 2016-12-30-test-1.md
root@AR:/usr/local/simonmar-blog/posts# cat 2016-12-30-test-1.md
---
layout: post
title: 测试1
description: ""
category: misc
tags: [misc]
---
这是测试1.
看看如何?
root@AR:/usr/local/simonmar-blog/posts# cd ..
root@AR:/usr/local/simonmar-blog#
export LC_ALL=C.UTF-8
root@AR:/usr/local/simonmar-blog# ./site rebuild
演示网站:http://smb.bright.biz.st/
项目地址:https://github.com/simonmar/blog