Total Pageviews

Monday, 22 August 2016

搭建基于hakyll的静态博客程序jelv.is

先安装ghc和cabal.

cd /usr/local
git clone https://github.com/TikhonJelvis/website jelv.is-site
cd jelv.is-site

root@AR:/usr/local/jelv.is-site# ls
atdp-demo       cow    frp       projects    talks
blog       css    hakyll.hs  projects.md  templates
blog-post.el       default.nix  img       README.md    tpl
blog-post.hs       deploy    index.md   scheme    website.cabal
cabal.sandbox.config  dist    js       Setup.hs
_cache       drafts    maze       shell.nix
cards       draw    misc       simulation
chess       fonts    mtg      
root@AR:/usr/local/jelv.is-site# cabal sandbox init
root@AR:/usr/local/jelv.is-site# cabal install (这2条命令安装静态博客程序)
显示:
...
dist/dist-sandbox-d5e9a6b0/build/website/

root@AR:/usr/local/jelv.is-site# ls dist/dist-sandbox-d5e9a6b0/build/website/
website
root@AR:/usr/local/jelv.is-site# dist/dist-sandbox-d5e9a6b0/build/website/website build (这就是生成/更新静态网站的根目录的命令)
root@AR:/usr/local/jelv.is-site# ls
atdp-demo       cow    frp       projects    talks
blog       css    hakyll.hs  projects.md  templates
blog-post.el       default.nix  img       README.md    tpl
blog-post.hs       deploy    index.md   scheme    website.cabal
cabal.sandbox.config  dist    js       Setup.hs
_cache       drafts    maze       shell.nix
cards       draw    misc       simulation
chess       fonts    mtg       _site

(生成了_site目录)
root@AR:/usr/local/jelv.is-site# cd _site
root@AR:/usr/local/jelv.is-site/_site# ls
af-slides.html   emacs-demo.png       office views.jpg
algebras.html   emacs-fonts-so.png   openSUSE-grub.jpg
atdp-demo   emacs.png        projects
blog   emacs-workflow.png   projects.html
browsers1.png   favicon.ico        README.html
browser-screen-usage.png  fonts        resume.pdf
browsers.png   frp        simulation
cards   img        stlc.html
chess   index.html        synthesis-slides.html
chlorophyll.pdf   index.png        talks
cow   instrsPassing.js     techniques.ps
css   Interpreter.hs.html  templates
demo.html   js        tpl
demo.png   maze        untyped-lambda-calculus.html
drafts   mtg        xmonad-chrome.png
draw   name-English.ogg     xmonad-ff.png
emacs-blackboard.png   name-Russian.ogg     xmonad-tiled.png
root@AR:/usr/local/jelv.is-site/_site# 
(可见/usr/local/jelv.is-site/_site/就是静态网站的根目录)

新建源贴:
root@AR:/usr/local/jelv.is-site/_site# cd ..
root@AR:/usr/local/jelv.is-site# cd blog 
root@AR:/usr/local/jelv.is-site/blog# ls
Generating-Mazes-with-Inductive-Graphs index.html   misc
Haskell-Monads-and-Purity Lazy-Dynamic-Programming
root@AR:/usr/local/jelv.is-site/blog# mkdir test-1
root@AR:/usr/local/jelv.is-site/blog# cd test-1
root@AR:/usr/local/jelv.is-site/blog/test-1# nano index.md
root@AR:/usr/local/jelv.is-site/blog/test-1# cat index.md
---
title: 测试1
author: brite
published: 2016-08-22 15:38:44
---

这是测试1.
<!--more-->看看如何呢?
(注意:这里的<!--more-->非有不可,无论帖子是否为长文。否则build时,会遇错)
root@AR:/usr/local/jelv.is-site/blog/test-1# cd ../..
root@AR:/usr/local/jelv.is-site# dist/dist-sandbox-d5e9a6b0/build/website/website build

演示网站:http://ji.smt.biz.st,http://ji.smt.biz.st/blog/
项目地址:https://github.com/TikhonJelvis/website/