Total Pageviews

Sunday, 13 October 2013

在linux vps上搭建基于ruby的静态博客程序-middleman

# gem install middleman
# middleman init middleman-project
# cd middleman-project
# bundle exec middleman server

This will start a local web server running at: http://localhost:4567/
You can create and edit files in the source folder and see the changes reflected on the preview web-server.
You can stop the preview server from the command-line using CTRL-C.

# bundle exec middleman build(运行该命令后,当前目录下会生成build目录,这个目录就是网站的根目录.你可绑定一个域名到此目录.我的情形为~/middleman-project/build)
# cd /root
# gem install middleman-blog
# middleman init middleman-project --template=blog
# cd middleman-project
# bundle exec middleman build
as3:~/middleman-project# ls
build  config.rb  Gemfile  Gemfile.lock  source
as3:~/middleman-project# cd source
as3:~/middleman-project/source# ls
2012-01-01-example-article.html.markdown  index.html.erb  stylesheets
calendar.html.erb                         javascripts     tag.html.erb
feed.xml.builder                          layout.erb
images                                    layouts
as3:~/middleman-project/source#
as3:~/middleman-project/source# bundle exec middleman article test1 (运行此命令生成空帖子test1。)
会显示create  source/2013-10-13-test1.html.markdown
然后在该markdown里添加文章内容。
as3:~/middleman-project/source# nano 2013-10-13-test1.html.markdown
(也可按此文件2012-01-01-example-article.html.markdown依样画葫芦,手动新建一个2013-10-13-test2.html.markdown文件,帖子的格式如下:
---
title: 帖子的标题
date: 2013-10-13
tags: misc
---

此处写正文  )
as3:~/middleman-project/source# cd ~/middleman-project/
as3:~/middleman-project# bundle exec middleman build (这个就是生成静态网站的命令。每次创建帖子后都要运行一次)

演示网站: http://as3.brite.biz:2244/,http://mm.brite.biz/
项目地址:
http://middlemanapp.com/getting-started/
https://middlemanapp.com/basics/build_and_deploy
http://middlemanapp.com/blogging/
https://github.com/viljamis/middleman-boilerplate
https://github.com/middleman/middleman
https://middlemanapp.com/community/built_using_middleman/ (使用middleman创建的站点)
https://github.com/edgecase/middleman-gh-pages