Total Pageviews

Sunday 25 December 2016

搭建基于haskell的静态博客程序CorentinDupont-WebPage

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

cd /usr/local
git clone https://github.com/cdupont/CorentinDupont-WebPage
cd  CorentinDupont-WebPage

root@AR:/usr/local/CorentinDupont-WebPage# ls
bibliography              css      index.html  pages      Setup.lhs
blog                  docs     js       projects  
blurbs                  haskell  LICENSE       README.md  stack.yaml
CorentinDupont-WebPage.cabal  images   news       research   templates
root@AR:/usr/local/CorentinDupont-WebPage# stack build (此步耗时2个半小时.openvz vps的性能果然不够佳)
(安装完毕后,没有Linking...之类的提示。不过切换目录到.stack-work/dist/i386-linux/Cabal-1.22.5.0/build/site/,可见到里面有一个site文件,这个site文件即为可执行文件。)
root@AR:/usr/local/CorentinDupont-WebPage# .stack-work/dist/i386-linux/Cabal-1.22.5.0/build/site/site clean && .stack-work/dist/i386-linux/Cabal-1.22.5.0/build/site/site build
(如果你之前搞过cabal install安装法请删除当前目录下的.cabal-sandbox目录。如果还遇错,请删除当前目录下的_cache目录)
root@AR:/usr/local/CorentinDupont-WebPage# ls
bibliography              css      index.html  pages      Setup.lhs
blog                  docs     js       projects   _site
blurbs                  haskell  LICENSE       README.md  stack.yaml
CorentinDupont-WebPage.cabal  images   news       research   templates
(生成了_site目录)
root@AR:/usr/local/CorentinDupont-WebPage# cd _site
root@AR:/usr/local/CorentinDupont-WebPage/_site# ls
blog  css  docs  images  index.html  js
root@AR:/usr/local/CorentinDupont-WebPage/_site#
(可见/usr/local/CorentinDupont-WebPage/_site就是静态网站的根目录)

新建源帖:
root@AR:/usr/local/CorentinDupont-WebPage/_site# cd ..
root@AR:/usr/local/CorentinDupont-WebPage# cd blog/posts
root@AR:/usr/local/CorentinDupont-WebPage/blog/posts# ls
Cosmology  Math  Others  Programming
root@AR:/usr/local/CorentinDupont-WebPage/blog/posts# cd Others
root@AR:/usr/local/CorentinDupont-WebPage/blog/posts/Others# nano 2016-12-25-test-1.md
root@AR:/usr/local/CorentinDupont-WebPage/blog/posts/Others# cat 2016-12-25-test-1.md
---
title: 测试1
description: 点击标题,看全文
tags: misc1, misc2, misc3
---

这是测试1.

看看如何?

root@AR:/usr/local/CorentinDupont-WebPage/blog/posts/Others#
root@AR:/usr/local/CorentinDupont-WebPage/blog/posts/Others# cd /usr/local/CorentinDupont-WebPage
root@AR:/usr/local/CorentinDupont-WebPage# rm -rf _cache
root@AR:/usr/local/CorentinDupont-WebPage# .stack-work/dist/i386-linux/Cabal-1.22.5.0/build/site/site clean && .stack-work/dist/i386-linux/Cabal-1.22.5.0/build/site/site build

演示网站:http://cdw.bright.biz.st, http://cdw.bright.biz.st/blog
项目地址:
https://github.com/cdupont/CorentinDupont-WebPage/issues/4
https://github.com/cdupont/CorentinDupont-WebPage