Total Pageviews

Saturday, 13 August 2016

安装基于hakyll的静态博客程序cascade of insights(这个不错,也支持分页)

cascadeofinsights基于haskell(7.8.4版)构建,所以需要安装haskell的7.8.4版。

首先安装某个具体版本的haskell(7.10.2版),方法如下。

问:
as per https://docs.haskellstack.org/en/stable/README/,
in my VPS,i ran:
curl -sSL https://get.haskellstack.org/ | sh

stack setup

but the Installed GHC's version is 7.10.3.
if i want to install 7.10.2 or 7.8.4, what should i do?

答:
You could specify the GHC_VERSION to stack setup, e.g.:
stack --resolver ghc-7.10.2 setup
(如果要安装7.8.4版,则stack --resolver ghc-7.8.4 setup)
and specify the desired GHC version in your project's config file- stack.yaml

另外:
You can also use as resolver (on the command line and especially in your project's stack.yaml) Stackage snapshots using the right GHC version, like lts-3.1 for 7.10.2, lts-3.22 for 7.10.2 or lts-2.22 for 7.8.4.
https://www.stackage.org/lts-2
https://www.stackage.org/lts-3

from https://github.com/commercialhaskell/stack/issues/2473

git clone -b hakyll https://github.com/agbell/agbell.github.io
cd agbell.github.io

root@AR:/usr/local/agbell.github.io# ls
about.md circle.yml  index.html   rss.xml   stack.yaml
app contact.md  new_post.sh  run.sh    templates
atom_init.sh css     posts  runStack
cascadeofinsights.cabal  images      README.md  _site
root@AR:/usr/local/agbell.github.io# stack setup --resolver ghc-7.8.4 
root@AR:/usr/local/agbell.github.io# stack build
会显示:
...
Linking .stack-work/dist/i386-linux/Cabal-1.22.4.0/build/cascadeofinsights/cascadeofinsights ...
Installing executable(s) in
/usr/local/agbell.github.io/.stack-work/install/i386-linux/lts-3.1/7.10.2/bin
...
root@AR:/usr/local/agbell.github.io#
root@AR:/usr/local/agbell.github.io# ls .stack-work/install/i386-linux/lts-3.1/7.10.2/bin
cascadeofinsights
root@AR:/usr/local/agbell.github.io#
root@AR:/usr/local/agbell.github.io# .stack-work/install/i386-linux/lts-3.1/7.10.2/bin/cascadeofinsights --help
The cascadeofinsights program

cascadeofinsights [COMMAND] ... [OPTIONS]
  Hakyll static site compiler

Commands:
  build    Generate the site
  check    Validate the site output
  clean    Clean up and remove cache
  deploy   Upload/deploy your site
  [help]   Show this message
  preview  [Deprecated] Please use the watch command
  rebuild  Clean and build again
  server   Start a preview server
  watch    Autocompile on changes and start a preview server.  You can watch
           and recompile without running a server with --no-server.
Common flags:
  -? --help     Display help message
  -V --version  Print version information
root@AR:/usr/local/agbell.github.io# .stack-work/install/i386-linux/lts-3.1/7.10.2/bin/cascadeofinsights build (这个就是生成/更新静态网站的命令)
root@AR:/usr/local/agbell.github.io# ls _site
(/usr/local/agbell.github.io/_site/里面有index.html,可见/usr/local/agbell.github.io/_site/就是静态网站的根目录.在此根目录里,把index.html重命名为index.html.bak,新建index.html文件,内容如下:
<meta http-equiv=refresh content="0;url=/pages/blog.html">

新建源贴:
root@AR:/usr/local/agbell.github.io# cd posts
root@AR:/usr/local/agbell.github.io/posts# nano 2016-08-13-test-1.md
root@AR:/usr/local/agbell.github.io/posts#
root@AR:/usr/local/agbell.github.io/posts# cat 2016-08-13-test-1.md
---
title: 测试1
author: brite fisherman
tags: misc1, misc2, misc3
---

这是测试1.
root@AR:/usr/local/agbell.github.io/posts# cd ..
root@AR:/usr/local/agbell.github.io# .stack-work/install/i386-linux/lts-3.1/7.10.2/bin/cascadeofinsights build

演示网站:http://coi.bright.biz.st,http://agbell.github.io(会跳转至http://cascadeofinsights.com)
项目地址:https://github.com/agbell/agbell.github.io/tree/hakyll