Total Pageviews

Saturday 14 January 2017

搭建基于haskell的静态博客程序polo2ro-blog

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

cd /usr/local
git clone https://github.com/polo2ro/blog  polo2ro-blog
cd polo2ro-blog

root@AR:/usr/local/polo2ro-blog# ls
README.md  about.html  css       posts    site.hs    templates
blog.cabal  images          
bower.json  index.html  stack.yaml
root@AR:/usr/local/polo2ro-blog# ghc --make site.hs
root@AR:/usr/local/polo2ro-blog# ls
README.md  about.html  css       posts    site.hs    templates
blog.cabal  images       site     site.o
bower.json  index.html  site.hi  stack.yaml
root@AR:/usr/local/polo2ro-blog# bower install --allow-root
root@AR:/usr/local/polo2ro-blog#  ./site rebuild
root@AR:/usr/local/polo2ro-blog# ls
README.md  about.html  css       posts    site.hs    templates
_cache       blog.cabal  images       site     site.o
_site       bower.json  index.html  site.hi  stack.yaml
root@AR:/usr/local/polo2ro-blog# cd _site
root@AR:/usr/local/polo2ro-blog/_site# ls
about.html  archive.html  bower_components posts
(缺乏index.html,于是新建index.html)
root@AR:/usr/local/polo2ro-blog/_site# nano index.html
root@AR:/usr/local/polo2ro-blog/_site# cat index.html
<meta http-equiv=refresh content="0;url=/archive.html">
root@AR:/usr/local/polo2ro-blog/_site#
(可见/usr/local/polo2ro-blog/_site就是静态网站的根目录)

新建源帖:
root@AR:/usr/local/polo2ro-blog/_site# cd ..
root@AR:/usr/local/polo2ro-blog# cd posts
root@AR:/usr/local/polo2ro-blog/posts# nano 2017-01-14-test-1.markdown
root@AR:/usr/local/polo2ro-blog/posts# cat  2017-01-14-test-1.markdown
---
title: 测试1
author: brite fisherman
lang: en
---

这是测试1.

看看如何?

root@AR:/usr/local/polo2ro-blog/posts# cd ..
root@AR:/usr/local/polo2ro-blog# ./site rebuild

演示网站:http://plr.bright.biz.st
项目地址:https://github.com/polo2ro/blog

No comments:

Post a Comment