Total Pageviews

Thursday 19 January 2017

搭建基于haskell的静态博客程序blog.debiania.in.ua

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

cd /usr/local
git clone https://github.com/Minoru/blog.debiania.in.ua
cd blog.debiania.in.ua

root@AR:/usr/local/blog.debiania.in.ua# ls
404.markdown             Setup.hs         debiania.hs  src
LICENSE.BSD3.txt       gather_tags  stack.yaml
LICENSE.CC-BY-NC-SA-4.0.txt  images      start_writing.sh
LICENSE.CC0.txt             about.markdown  misc      subscribe.markdown
MathJax                 css         posts      templates
README.markdown             debiania.cabal  robots.txt
root@AR:/usr/local/blog.debiania.in.ua#  stack build
会显示:
...
Linking .stack-work/dist/i386-linux/Cabal-1.22.5.0/build/debiania/debiania ...
debiania-3.0.0: copy/register
Installing executable(s) in
/usr/local/blog.debiania.in.ua/.stack-work/install/i386-linux/lts-6.20/7.10.3/bin
Completed 126 action(s).
root@AR:/usr/local/blog.debiania.in.ua# .stack-work/dist/i386-linux/Cabal-1.22.5.0/build/debiania/debiania build
(这个就是生成/更新静态网站的根目录的命令。期间可能遇错:“[ERROR] 7z: createProcess: runInteractiveProcess: exec: does not exist (No such file or directory)",意思是未找到7z这个可执行文件,解决办法:apt-get install p7zip-full -y,参考https://codeyarns.com/2014/05/08/atool-error-cant-exec-7z/)
root@AR:/usr/local/blog.debiania.in.ua# ls
404.markdown             Setup.hs         debiania.hs  src
LICENSE.BSD3.txt         _cache         gather_tags  stack.yaml
LICENSE.CC-BY-NC-SA-4.0.txt  _site         images      start_writing.sh
LICENSE.CC0.txt             about.markdown  misc      subscribe.markdown
MathJax                 css         posts      templates
README.markdown             debiania.cabal  robots.txt
(生成了_site目录)
root@AR:/usr/local/blog.debiania.in.ua#  cd _site
root@AR:/usr/local/blog.debiania.in.ua/_site# ls
404.html       css       index.html.gz  posts.html.gz   subscribe.html
404.html.gz    feeds       misc          robots.txt      subscribe.html.gz
about.html     images       posts      sitemap.xml
about.html.gz  index.html  posts.html      sitemap.xml.gz
root@AR:/usr/local/blog.debiania.in.ua/_site#
(可见 /usr/local/blog.debiania.in.ua/_site就是静态网站的根目录)

新建源帖:
 root@AR:/usr/local/blog.debiania.in.ua/_site# cd ..
 root@AR:/usr/local/blog.debiania.in.ua# cd posts
root@AR:/usr/local/blog.debiania.in.ua/posts# nano 2017-01-18-test-1.markdown
root@AR:/usr/local/blog.debiania.in.ua/posts# cat 2017-01-18-test-1.markdown
---
title: 测试1
language: english
description: 这是测试...
tags: misc1, misc2, misc3
---

这是测试1.

看看如何?

root@AR:/usr/local/blog.debiania.in.ua/posts# cd ..
root@AR:/usr/local/blog.debiania.in.ua# .stack-work/dist/i386-linux/Cabal-1.22.5.0/build/debiania/debiania build

演示网站:http://diu.bright.biz.st
项目地址:https://github.com/Minoru/blog.debiania.in.ua

No comments:

Post a Comment