Total Pageviews

Wednesday, 30 November 2016

搭建基于nodejs的静态博客程序heckle

首先安装node环境(最低需为6.x版)

cd /usr/local
git clone https://github.com/marijnh/heckle/ heckle-by-marijnh
cd heckle-by-marijnh
ls /usr/local/heckle-by-marijnh/
显示:
heckle.js  LICENSE  package.json  README.md  util.js
root@AR:/usr/local/heckle-by-marijnh# npm install
(会提示codemirror模块未安装成功。于是编辑package.json文件,把"codemirror"的值改为5.21.0)
root@AR:/usr/local/heckle-by-marijnh# npm install
(再次运行npm install,这次应该没有出错提示了。如果还是提示没有xyz模块,则运行npm install xyz进行安装。)
root@AR:/usr/local/heckle-by-marijnh# git clone https://github.com/marijnh/blog
root@AR:/usr/local/heckle-by-marijnh# cd blog
root@AR:/usr/local/heckle-by-marijnh/blog# ls
_config.yml  feed.md  _includes  index.md  _layouts  _posts  res
root@AR:/usr/local/heckle-by-marijnh/blog# ls ..
blog  heckle.js  LICENSE  node_modules    package.json  README.md  util.js
root@AR:/usr/local/heckle-by-marijnh/blog# node ../heckle.js (这个就是生成/更新静态网站的根目录的命令)
root@AR:/usr/local/heckle-by-marijnh/blog# ls
_config.yml  feed.md  _includes  index.md  _layouts  _posts  res  _site
(生成了_site目录)
root@AR:/usr/local/heckle-by-marijnh/blog# cd _site
root@AR:/usr/local/heckle-by-marijnh/blog/_site# ls
acorn.html                   if-hemingway-wrote-javascript.html
a-pathological-scrolling-model.html    index.html
browser-input-reading.html           interning.html
closure-vs-object-performance.html     mold.html
cl-tk.html                   my-babel-setup.html
codemirror-2.34-and-3beta1.html        null-and-undefined.html
codemirror-line-tree.html           parse-dammit.html
codemirror-marked-ranges.html           parse-js.html
codemirror-mode-system.html           pcall.html
codemirror-shared-documents.html       postmodern-1.13.html
collaborative-editing.html           postmodern-1.19.html
common-lisp-monads.html               prosemirror.html
cursor-in-bidi-text.html           recurse-center.html
display-updates-in-codemirror.html     res
eloquent-javascipts-build-system.html  st-json.html
feed.atom                   sustainable-maintenance.html
heckle.html                   tern.html
http-caching.html
root@AR:/usr/local/heckle-by-marijnh/blog/_site#
(可见/usr/local/heckle-by-marijnh/blog/_site就是静态网站的根目录)

新建源帖:
root@AR:/usr/local/heckle-by-marijnh/blog/_site# cd ..
root@AR:/usr/local/heckle-by-marijnh/blog# ls
_config.yml  feed.md  _includes  index.md  _layouts  _posts  res  _site
root@AR:/usr/local/heckle-by-marijnh/blog# cd _posts
root@AR:/usr/local/heckle-by-marijnh/blog/_posts# nano 2016-11-30-test-1.md
root@AR:/usr/local/heckle-by-marijnh/blog/_posts# cat 2016-11-30-test-1.md
---
layout: post
title: 测试1
tags:
- misc1
- misc2
---

这是测试1。

看看如何?

root@AR:/usr/local/heckle-by-marijnh/blog/_posts# cd ..
root@AR:/usr/local/heckle-by-marijnh/blog# node ../heckle.js

演示网站:http://hc.bright.biz.st
项目地址:https://github.com/marijnh/heckle
https://github.com/marijnh/blog

注意:这个heckle不是那个heckle: http://briteming.blogspot.com/2016/11/haskellheckle.html