Total Pageviews

Friday 24 February 2017

搭建基于nodejs的静态博客程序ksmithut.github.io

先搭建nodejs环境。

cd /usr/local
git clone https://github.com/luckypoem/ksmithut.github.io
cd ksmithut.github.io

root@AR:/usr/local/ksmithut.github.io# ls
README.md   gulp   src
bower.json  content     gulpfile.js  package.json
root@AR:/usr/local/ksmithut.github.io# npm install
root@AR:/usr/local/ksmithut.github.io# bower install --allow-root
root@AR:/usr/local/ksmithut.github.io# npm run build (此即生成/更新静态网站的根目录的命令)
root@AR:/usr/local/ksmithut.github.io# ls
README.md   bower_components  dist    gulp         node_modules  src
bower.json  content  gulpfile.js  package.json
(生成了dist目录)
root@AR:/usr/local/ksmithut.github.io# cd dist
root@AR:/usr/local/ksmithut.github.io/dist# ls
2014  2015  2017  css  favicon.ico  images  index.html    js  maps  posts  projects
root@AR:/usr/local/ksmithut.github.io/dist# 
(可见/usr/local/ksmithut.github.io/dist就是静态网站的根目录)

新建源帖:
root@AR:/usr/local/ksmithut.github.io/dist# cd ../content
root@AR:/usr/local/ksmithut.github.io/content# ls
2014  2015  index.md  projects
root@AR:/usr/local/ksmithut.github.io/content# mkdir -p 2017/02/23
root@AR:/usr/local/ksmithut.github.io/content cd 2017/02/23
root@AR:/usr/local/ksmithut.github.io/content/2017/02/23# nano test-1.md
root@AR:/usr/local/ksmithut.github.io/content/2017/02/23# cat test-1.md
---
title: 测试1(test-one)
description: 点击标题,看全文
tags:
- misc1
- misc2
- misc3
---

这是测试1.

看看如何?

root@AR:/usr/local/ksmithut.github.io/content/2017/02/23#
root@AR:/usr/local/ksmithut.github.io/content/2017/02/23# ls
test-1.md  test-2.md  uce.md  vbilu.md
root@AR:/usr/local/ksmithut.github.io/content/2017/02/23# cd /usr/local/ksmithut.github.io
root@AR:/usr/local/ksmithut.github.io# npm run build

演示网站:http://kgi.bright.biz.st/,http://kgi.bright.biz.st/posts/ ( 支持分页)
项目地址:https://github.com/luckypoem/ksmithut.github.io

No comments:

Post a Comment