首先按此文http://briteming.blogspot.com/2016/07/hakyll.html安装stack,ghc和hakyll.
cd /usr/local
git clone https://github.com/ericrasmussen/chromaticleaves chromaticleaves-site
cd chromaticleaves-site
ghc --make site.hs (运行此命令,会遇错,见https://github.com/ericrasmussen/chromaticleaves/issues/2)
解决办法:
修改site.hs文件如下:
把import Data.Time.Format (formatTime)改为:
import Data.Time.Format (formatTime, defaultTimeLocale)
删除此行:
import System.Locale (defaultTimeLocale)
(参见https://github.com/michaelsproul/sproul.xyz/commit/06cf3473933d25fa2a99f0ff206159010ec95900的site.hs部分)
ghc --make site.hs (这次运行此命令不会遇错了。会在当前目录下,生成可执行文件site)
./site build (运行此步骤会遇错:
Hint: if the metadata value contains characters such
as ':' or '-', try enclosing it in quotes.
解决办法:把每次遇错的源贴里的title的值加上英文双引号。
rm posts/*.lhs )
./site build (又遇错:
[ERROR] Missing field $metadescription$ in context for item commands.markdown,解决办法:
给metadescription设置一个值,比如abc)
./site build (又遇错:
[ERROR] Hakyll.Core.UnixFilter.unixFilterWith: sass -s --scss gave exit code 65,解决办法:
其实之前,我是装过sass的,安装命令为gem install sass,不过这样安装出来的sass的版本为3.4.22,而这个静态博客程序chromatic leaves要求sass的版本为3.3.0,解决办法就是先卸载sass:
gem uninstall sass,然后安装指定版本-3.3.0版的sass: gem install sass --version=3.3.0)
./site build (这次运行不再遇错。在当前目录下,会生成_site目录)
新建源贴:
cd /usr/local
git clone https://github.com/ericrasmussen/chromaticleaves chromaticleaves-site
cd chromaticleaves-site
ghc --make site.hs (运行此命令,会遇错,见https://github.com/ericrasmussen/chromaticleaves/issues/2)
解决办法:
修改site.hs文件如下:
把import Data.Time.Format (formatTime)改为:
import Data.Time.Format (formatTime, defaultTimeLocale)
删除此行:
import System.Locale (defaultTimeLocale)
(参见https://github.com/michaelsproul/sproul.xyz/commit/06cf3473933d25fa2a99f0ff206159010ec95900的site.hs部分)
ghc --make site.hs (这次运行此命令不会遇错了。会在当前目录下,生成可执行文件site)
./site build (运行此步骤会遇错:
Hint: if the metadata value contains characters such
as ':' or '-', try enclosing it in quotes.
解决办法:把每次遇错的源贴里的title的值加上英文双引号。
rm posts/*.lhs )
./site build (又遇错:
[ERROR] Missing field $metadescription$ in context for item commands.markdown,解决办法:
给metadescription设置一个值,比如abc)
./site build (又遇错:
[ERROR] Hakyll.Core.UnixFilter.unixFilterWith: sass -s --scss gave exit code 65,解决办法:
其实之前,我是装过sass的,安装命令为gem install sass,不过这样安装出来的sass的版本为3.4.22,而这个静态博客程序chromatic leaves要求sass的版本为3.3.0,解决办法就是先卸载sass:
gem uninstall sass,然后安装指定版本-3.3.0版的sass: gem install sass --version=3.3.0)
./site build (这次运行不再遇错。在当前目录下,会生成_site目录)
root@AR:/usr/local/chromaticleaves-site# cd _site
root@AR:/usr/local/chromaticleaves-site/_site# ls
404.html css images posts scores
about.html explore index.html posts.html slides
commands.html foundation js rss.xml tags
root@AR:/usr/local/chromaticleaves-site/_site#
(可见/usr/local/chromaticleaves-site/_site就是静态网站的根目录)新建源贴:
root@AR:/usr/local/chromaticleaves-site/_site# cd ..
root@AR:/usr/local/chromaticleaves-site# cd posts
root@AR:/usr/local/chromaticleaves-site/posts# nano test-1.markdown
root@AR:/usr/local/chromaticleaves-site/posts# cat test-1.markdown
---
title: "测试1"
date: 2016-11-03
tags: misc1, misc2, misc3
metadescription: abc
---
这是测试1.
看看如何呢?
root@AR:/usr/local/chromaticleaves-site/posts# cd ..
root@AR:/usr/local/chromaticleaves-site# ./site build
演示网站:http://cl.bright.biz.st
项目地址:https://github.com/ericrasmussen/chromaticleaves
相关帖子:http://briteming.blogspot.com/2016/11/machakyllsproulxyzlinux-vps.html