Pages

Saturday, 4 February 2017

搭建基于haskell的静态博客程序blog.emillon.org

按此文http://briteming.blogspot.jp/2016/07/hakyll.html,安装stack,ghc,hakyll.

cd /usr/local
git clone https://github.com/emillon/blog.emillon.org
cd  blog.emillon.org

root@AR:/usr/local/blog.emillon.org# stack init --solver (因为当前目录下存在cabal文件)
root@AR:/usr/local/blog.emillon.org# stack build
会显示:
...
Linking .stack-work/dist/i386-linux/Cabal-1.24.2.0/build/blog/blog ...
                
Warning: The following modules should be added to exposed-modules or other-modules in /usr/local/blog.emillon.org/blog.cabal:
    - In blog component:
        AssetDirectory

Missing modules in the cabal file are likely to cause undefined reference errors from the linker, along with other problems.
blog-0.1.0.0: copy/register
Installing executable(s) in
/usr/local/blog.emillon.org/.stack-work/install/i386-linux/nightly-2017-02-03/8.0.2/bin
Completed 152 action(s).
root@AR:/usr/local/blog.emillon.org# .stack-work/dist/i386-linux/Cabal-1.24.2.0/build/blog/blog build
root@AR:/usr/local/blog.emillon.org# cd _site
root@AR:/usr/local/blog.emillon.org/_site# ls
css    favicon.ico  fonts  index.html    posts.html  rss.xml
drafts    feeds         img    posts    robots.txt  tags
root@AR:/usr/local/blog.emillon.org/_site#
(可见/usr/local/blog.emillon.org/_site就是静态网站的根目录)

新建源帖:
root@AR:/usr/local/blog.emillon.org/_site# cd ../posts
root@AR:/usr/local/blog.emillon.org/posts# nano 2017-02-04-test-1.mdwn
root@AR:/usr/local/blog.emillon.org/posts# cat 2017-02-04-test-1.mdwn
---
title: 测试1
tags: misc1, misc2, misc3
author: brite fisherman
---

这是测试1.

看看如何?

 (注意:上面的“---”一定要用退格键退到左上方,一直到退不动为止。
root@AR:/usr/local/blog.emillon.org/posts# cd ..
root@AR:/usr/local/blog.emillon.org# .stack-work/dist/i386-linux/Cabal-1.24.2.0/build/blog/blog build

演示网站:http://beo.bright.biz.st
项目地址:https://github.com/emillon/blog.emillon.org

No comments:

Post a Comment