Total Pageviews

Friday, 22 July 2016

基于nodejs的静态博客程序-metalsmith

登陆linux vps,安装nodejs.
然后npm install -g metalsmith(这一步其实是多余的。)

git clone https://github.com/blakeembrey/blakeembrey.com /usr/local/blakeembrey.com-site/
cd  /usr/local/blakeembrey.com-site/

root@AR:/usr/local/blakeembrey.com-site# ls
config   readme.md  templates
build.js  LICENSE  package.json  src
root@AR:/usr/local/blakeembrey.com-site# npm install
(因为目录中有package.json文件,于是运行 npm install来安装该程序的一些依赖/模块)
root@AR:/usr/local/blakeembrey.com-site# ls
config   node_modules  readme.md  templates
build.js  LICENSE  package.json  src
root@AR:/usr/local/blakeembrey.com-site#
(运行 npm install后,就会生成node_modules目录)
root@AR:/usr/local/blakeembrey.com-site# node build.js (这个就是生成静态网站的命令)
root@AR:/usr/local/blakeembrey.com-site# ls
build      config   node_modules  readme.md  templates
build.js  LICENSE  package.json  src
(生成了build目录)
root@AR:/usr/local/blakeembrey.com-site# cd build
root@AR:/usr/local/blakeembrey.com-site/build# ls
articles  CNAME  css  favicon.ico  feed.xml  index.html  page  vendor
(/usr/local/blakeembrey.com-site/build/目录里有index.html文件,可见/usr/local/blakeembrey.com-site/build/目录就是静态网站的根目录,你可绑定域名到该目录)


新建源贴:
root@AR:/usr/local/blakeembrey.com-site/build# cd ..
root@AR:/usr/local/blakeembrey.com-site# cd src
root@AR:/usr/local/blakeembrey.com-site/src# ls
articles  CNAME  css  favicon.ico  feed.xml  vendor
root@AR:/usr/local/blakeembrey.com-site/src# cd articles
root@AR:/usr/local/blakeembrey.com-site/src/articles# ls
2011  2012  2013  2014    2015  2016
root@AR:/usr/local/blakeembrey.com-site/src/articles# cd 2016
root@AR:/usr/local/blakeembrey.com-site/src/articles/2016# ls
01 
root@AR:/usr/local/blakeembrey.com-site/src/articles/2016# cd 01
root@AR:/usr/local/blakeembrey.com-site/src/articles/2016/01# ls
intro-to-free-style-css-in-js
root@AR:/usr/local/blakeembrey.com-site/src/articles/2016/01# cd intro-to-free-style-css-in-js
root@AR:/usr/local/blakeembrey.com-site/src/articles/2016/01/intro-to-free-style-css-in-js# ls
index.md
root@AR:/usr/local/blakeembrey.com-site/src/articles/2016/01/intro-to-free-style-css-in-js#

按/usr/local/blakeembrey.com-site/src/articles/2016/01/intro-to-free-style-css-in-js/index.md文件的格式,操作如下:
root@AR:/usr/local/blakeembrey.com-site/src/articles/2016/01/intro-to-free-style-css-in-js# cd /usr/local/blakeembrey.com-site/src/articles/2016/
root@AR:/usr/local/blakeembrey.com-site/src/articles/2016# mkdir 07
root@AR:/usr/local/blakeembrey.com-site/src/articles/2016#  cd 07
oot@AR:/usr/local/blakeembrey.com-site/src/articles/2016/07# mkdir marriage
root@AR:/usr/local/blakeembrey.com-site/src/articles/2016/07# cd marriage
root@AR:/usr/local/blakeembrey.com-site/src/articles/2016/07/marriage# nano index.md
root@AR:/usr/local/blakeembrey.com-site/src/articles/2016/07/marriage# cat index.md
---
title: 周国平谈女人,爱情,婚姻

date: 2016-07-23 13:07
author: brite
template: article.jade
github: blakeembrey/free-style
npm: free-style
---


此处写正文。
root@AR:/usr/local/blakeembrey.com-site/src/articles/2016/07/marriage#  cd /usr/local/blakeembrey.com-site
root@AR:/usr/local/blakeembrey.com-site# node build.js

演示网站:http://be.smt.biz.st/, http://be.bright.biz.st/
项目地址:https://github.com/metalsmith/metalsmith
https://github.com/blakeembrey/blakeembrey.com

Resources

----------------------------------------

Tutorials

Using Metalsmith

Building Plugins

Plugins

Here is the GitHub query for "metalsmith".
Here is a list of plugin links.
Here are the plugins featured on the Metalsmith.io website. If you want to add yours, submit a pull request!

Generator

Examples

Blogs

Site

Repository

from  https://github.com/metalsmith/awesome-metalsmith