Pages

Monday, 16 January 2017

搭建基于haskell的静态博客程序jdreaver.com

先按此文http://briteming.blogspot.jp/2016/07/hakyll.html,安装stack和ghc.
 
cd /usr/local
git clone https://github.com/jdreaver/jdreaver.com
cd  jdreaver.com
 
root@AR:/usr/local/jdreaver.com# ls
Setup.hs   contact.markdown   index.html         templates
css             hakyll.hs    jdreaver-site.cabal
drafts         posts
about.rst   images    stack.yaml
root@AR:/usr/local/jdreaver.com# ghc --make hakyll.hs (会在当前目录下,生成可执行文件hakyll)
root@AR:/usr/local/jdreaver.com# ./hakyll build (会在当前目录下,生成_site目录)
root@AR:/usr/local/jdreaver.com# ls
Setup.hs   contact.markdown  hakyll.hi    index.html         templates
_cache       css             hakyll.hs    jdreaver-site.cabal
_site       drafts         hakyll.o    posts
about.rst  hakyll         images    stack.yaml
root@AR:/usr/local/jdreaver.com# cd _site
root@AR:/usr/local/jdreaver.com/_site# ls
about.html  archive.html  contact.html    css  images  index.html  posts
root@AR:/usr/local/jdreaver.com/_site# 
(可见/usr/local/jdreaver.com/_site就是静态网站的根目录)
 
新建源帖:
root@AR:/usr/local/jdreaver.com/_site# cd ../posts
root@AR:/usr/local/jdreaver.com/posts# nano 2017-01-16-test-1.markdown
root@AR:/usr/local/jdreaver.com/posts# cat 2017-01-16-test-1.markdown
---
title: 测试1
---

这是测试1.

看看如何?

root@AR:/usr/local/jdreaver.com/posts# cd ..
root@AR:/usr/local/jdreaver.com# ./hakyll build

演示网站:http://jdr.bright.biz.st
项目地址:https://github.com/jdreaver/jdreaver.com

No comments:

Post a Comment