Total Pageviews

Wednesday 1 February 2017

搭建基于haskell的静态博客程序liamoc.net

先按此文http://briteming.blogspot.jp/2016/07/hakyll.html,安装stack,ghc,hakyll.
 cd /usr/local
git clone https://github.com/liamoc/liamoc.net
cd  liamoc.net

root@AR:/usr/local/liamoc.net# stack build
(当前目录下,有stack.yaml文件,于是可运行stack build,不过遇错。因为他这个程序用到了agda,所以apt-get install agda-mode agda-stdlib ,参见http://agda.readthedocs.io/en/latest/getting-started/installation.html 。再次运行stack build又遇错2次,按其给出的提示,把stack.yaml文件修改如下)
root@AR:/usr/local/liamoc.net# nano stack.yaml
root@AR:/usr/local/liamoc.net# cat stack.yaml
flags: {}
extra-package-dbs: []
packages:
- '.'
extra-deps:
- Agda-2.5.1
- EdisonAPI-1.3
- EdisonCore-1.3.1.1
- QuickCheck-2.8.2
- latex-formulae-hakyll-0.2.0.2
- monadplus-1.4.2
- agda-snippets-hakyll-0.1.2.1
- agda-snippets-2.5.1

resolver: lts-5.8
root@AR:/usr/local/liamoc.net#  stack build
会显示:
...
Linking .stack-work/dist/i386-linux/Cabal-1.22.5.0/build/Website/Website ...
Website-0.1.0.0: copy/register
Installing executable(s) in
/usr/local/liamoc.net/.stack-work/install/i386-linux/lts-5.8/7.10.3/bin
Completed 151 action(s).
root@AR:/usr/local/liamoc.net#  .stack-work/dist/i386-linux/Cabal-1.22.5.0/build/Website/Website rebuild (此即生成/更新静态网站的根目录的命令.运行时会遇错,删除./posts/里的所有的.lagda文件和.lagda.meta文件,然后再运行一次此命令。会生成_site目录)
root@AR:/usr/local/liamoc.net# cd _site
root@AR:/usr/local/liamoc.net/_site# ls
archive.html  contact.html  images    js     publications.html  tags
atom.xml      css        index.html    posts  rss.xml
root@AR:/usr/local/liamoc.net/_site# 
(可见/usr/local/liamoc.net/_site就是静态网站的根目录)

新建源帖:
root@AR:/usr/local/liamoc.net/_site# cd ../posts
root@AR:/usr/local/liamoc.net/posts# nano 2017-02-01-test-1.markdown
root@AR:/usr/local/liamoc.net/posts# cat 2017-02-01-test-1.markdown
---
title: 测试1
tags: misc1, misc2, misc3
---

这是测试1.

看看如何?

root@AR:/usr/local/liamoc.net/posts# cd ..
root@AR:/usr/local/liamoc.net# .stack-work/dist/i386-linux/Cabal-1.22.5.0/build/Website/Website rebuild

演示网站:http://lmn.bright.biz.st/,http://lmn.bright.biz.st/archive.html
项目地址:https://github.com/liamoc/liamoc.net

No comments:

Post a Comment