Total Pageviews

Friday 27 January 2017

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

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

cd /usr/local
git clone  https://github.com/utdemir/utdemir.com
cd utdemir.com

root@AR:/usr/local/utdemir.com# ls
default.nix  generator    publish.sh  site
root@AR:/usr/local/utdemir.com# cd generator
root@AR:/usr/local/utdemir.com/generator# ls
Main.hs   
root@AR:/usr/local/utdemir.com/generator# ghc --make Main.hs (会在当前目录下,生成可执行文件Main。当然其实你也可把Main.hs重命名为常见的文件名site.hs,这样在当前目录下,生成的可执行文件就是site了)
root@AR:/usr/local/utdemir.com/generator#
root@AR:/usr/local/utdemir.com/generator# cp Main ../site/
root@AR:/usr/local/utdemir.com/generator# cd ../site/
root@AR:/usr/local/utdemir.com/site# ls
Main  images  index.md  posts  root  static  templates
root@AR:/usr/local/utdemir.com/site# ./Main build
root@AR:/usr/local/utdemir.com/site# ls
Main  _cache  _site  images  index.md  posts  root  static  templates
root@AR:/usr/local/utdemir.com/site# cd _site
root@AR:/usr/local/utdemir.com/site/_site# ls
CNAME      google768f27d36eb2dc2d.html  index.html   posts
atom.xml  images               keybase.txt  static
root@AR:/usr/local/utdemir.com/site/_site#
(可见/usr/local/utdemir.com/site/_site就是静态网站的根目录)

新建源帖:
root@AR:/usr/local/utdemir.com/site/_site# cd ../posts
root@AR:/usr/local/utdemir.com/site/posts# nano test-1.md
root@AR:/usr/local/utdemir.com/site/posts# cat test-1.md
---
title: 测试1
date: 2017-01-28 00:57:00
---

这是测试1.

看看如何?

root@AR:/usr/local/utdemir.com/site/posts#  cd ..
root@AR:/usr/local/utdemir.com/site# ./Main rebuild

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

No comments:

Post a Comment