Total Pageviews

Tuesday 21 February 2017

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

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

cd /usr/local
git clone https://github.com/LeviSchuck/levischuck.com
cd  levischuck.com

root@AR:/usr/local/levischuck.com# cd src
root@AR:/usr/local/levischuck.com/src# ls  
Main.hs  
root@AR:/usr/local/levischuck.com/src# ghc --make
Main.hs  (会在当前目录下,生成可执行文件Main)
 root@AR:/usr/local/levischuck.com/src# cp Main ..
 root@AR:/usr/local/levischuck.com/src# cd ..
 root@AR:/usr/local/levischuck.com# ./Main build (此即生成/更新静态网站的根目录的命令。会在当前目录下,生成_site目录)
 root@AR:/usr/local/levischuck.com#cd _site
root@AR:/usr/local/levischuck.com/_site# ls
archive.html  chats  concepts  contact.html  css  pages  posts    projects
root@AR:/usr/local/levischuck.com/_site# mv
archive.html index.html
(可见/usr/local/levischuck.com/_site就是静态网站的根目录)

新建源帖:
root@AR:/usr/local/levischuck.com/_site# cd ../posts
root@AR:/usr/local/levischuck.com/posts# nano test-1.md

root@AR:/usr/local/levischuck.com/posts# cat test-1.md
---
layout: post
title: 测试1
date: 2017-02-14 08:54:00
comments: true
categories: misc
---

这是测试1.

看看如何?

root@AR:/usr/local/levischuck.com/posts#  cd ..

root@AR:/usr/local/levischuck.com# ./Main rebuild
root@AR:/usr/local/levischuck.com# cd _site
root@AR:/usr/local/levischuck.com/_site# nano index.html

root@AR:/usr/local/levischuck.com/_site# cat index.html
<meta http-equiv=refresh content='0;url=/archive.html'>
root@AR:/usr/local/levischuck.com/_site#

  演示网站:http://lsc.bright.biz.st
项目地址:https://github.com/LeviSchuck/levischuck.com

No comments:

Post a Comment