Total Pageviews

Friday, 15 November 2013

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

php -r "$(curl -s http://gumdropapp.com/installer.php|tail -n +2)" (会提示你为gumdrop项目取一个名字,我取名为gumdrop-project)
curl -sS https://getcomposer.org/installer | php (如果你未装过composer,就运行此条命令)
cd gumdrop-project
php composer.phar create-project simonjodet/gumdrop_blog_template myblog (此条命令会在当前目录下,生成myblog目录)
cd myblog
_vendor/bin/gumdrop

as3:~/gumdrop-project# ls
composer.json  composer.phar  _vendor
composer.lock  conf.json      myblog    vendor
(运行 _vendor/bin/gumdrop后,在~/gumdrop-project/里就新出现了myblog和 vendor目录)
as3:~/gumdrop-project# cd myblog
as3:~/gumdrop-project/myblog# ls
assets         conf.json          posts                sitemap.xml.twig
atom.xml.twig  index.html.twig    README.md            sitemap.xsl
composer.json  _layout            search_db.json.twig  _tools
composer.lock  page_db.json.twig  _site                _vendor
as3:~/gumdrop-project/myblog# ls posts
1970-01-01-welcome-on-gumdrop-s-blog-template.markdown
as3:~/gumdrop-project/myblog# ls _site (此时_site目录还是个空目录)
as3:~/gumdrop-project/myblog# _vendor/bin/gumdrop (这个就是生成/更新静态网站的命令)
Gumdrop converted your MarkDown files to /root/gumdrop-project/myblog/_site
as3:~/gumdrop-project/myblog# ls _site
assets    index.html    posts           sitemap.xml
atom.xml  page_db.json  search_db.json  sitemap.xsl
(可见/root/gumdrop-project/myblog/_site/就是静态网站的根目录)
as3:~/gumdrop-project/myblog# cd _site
as3:~/gumdrop-project/myblog/_site# ls
assets    index.html    posts           sitemap.xml
atom.xml  page_db.json  search_db.json  sitemap.xsl
as3:~/gumdrop-project/myblog/_site# Rwebserver 4529 &
访问http://as3.brite.biz:4529/,立马可看到网站效果。

发贴方法:
as3:~/gumdrop-project/myblog/_site# cd ../posts
as3:~/gumdrop-project/myblog/posts# ls
1970-01-01-welcome-on-gumdrop-s-blog-template.markdown
按照1970-01-01-welcome-on-gumdrop-s-blog-template.markdown的格式,新建帖子
2013-11-15-test1.md,格式如下:
***
{
    "title":"test1",
    "date":"2013-11-15",
    "layout":"post.twig"
}
***
这是测试1.

然后:
as3:~/gumdrop-project/myblog/posts# cd ..
as3:~/gumdrop-project/myblog# _vendor/bin/gumdrop

演示站点:http://gd.brite.biz
使用指南:
http://simonjodet.github.io/gumdrop/documentation.htm
http://gumdropapp.com/documentation.htm
项目地址:https://github.com/simonjodet/gumdrop