Total Pageviews

Tuesday 25 October 2016

搭建基于hakyll的静态博客程序coldwaste

首先按此文http://briteming.blogspot.com/2016/07/hakyll.html安装ghc和hakyll.
cd /usr/local
git clone https://github.com/23Skidoo/homepage coldwa.st_e-site
cd coldwa.st_e-site

root@AR:/usr/local/coldwa.st_e-site# cd content
root@AR:/usr/local/coldwa.st_e-site/content# ls
404.md css     js
blog favicon.ico  img       Makefile templates
files     hakyll.hs index.md  README

root@AR:/usr/local/coldwa.st_e-site/content# ghc --make hakyll.hs
(此命令会在当前目录下,生成可执行文件hakyll)
root@AR:/usr/local/coldwa.st_e-site/content# mv index.md index.md.old
root@AR:/usr/local/coldwa.st_e-site/content# ./hakyll build
root@AR:/usr/local/coldwa.st_e-site/content# ls
404.md css     hakyll hakyll.o      js _site
blog favicon.ico  hakyll.hi img       Makefile templates
_cache files     hakyll.hs index.md.old  README
(生成了目录_site)
root@AR:/usr/local/coldwa.st_e-site/content# cd _site
root@AR:/usr/local/coldwa.st_e-site/content/_site# ls
404.html  blog css  favicon.ico  files  img  entries.html  rss.xml  tags
root@AR:/usr/local/coldwa.st_e-site/content/_site# python -m SimpleHTTPServer 3456 > /dev/null &

访问http://your-vps-ip:3456/entries.html ,即可看到静态网站效果。
为了访问http://your-vps-ip:3456即可看到静态网站效果,把entries.html 改为index.html即可。
/usr/local/coldwa.st_e-site/content/_site就是静态网站的根目录,你可绑定域名到该目录。

新建源贴:
root@AR:/usr/local/coldwa.st_e-site/content/_site# cd ..
root@AR:/usr/local/coldwa.st_e-site/content# cd blog
root@AR:/usr/local/coldwa.st_e-site/content/blog# nano 2016-10-24-test-1.md
root@AR:/usr/local/coldwa.st_e-site/content/blog# cat 2016-10-24-test-1.md
---
title: 测试1
description: 点击标题看全文
tags: misc1, misc2, misc3
---

这是测试1.
root@AR:/usr/local/coldwa.st_e-site/content/blog# cd ..
root@AR:/usr/local/coldwa.st_e-site/content# ./hakyll build
root@AR:/usr/local/coldwa.st_e-site/content# cd _site
root@AR:/usr/local/coldwa.st_e-site/content/_site# rm index.html
root@AR:/usr/local/coldwa.st_e-site/content/_site# mv entries.html index.html

演示网站:http://cw.bright.biz.st/, http://coldwa.st/e/blog
项目地址:https://github.com/23Skidoo/homepage