Pages

Sunday, 3 November 2013

搭建基于php的静态博客程序piecrust

我是在PHP 5.5.9上搭建成功的。php7是不行的。php6环境下,我没试过。

git clone https://github.com/ludovicchabant/PieCrust piecrust-site
cd piecrust-site

root@localhost:/usr/local/piecrust-site#  ls
bin                 composer.json  LICENSE.markdown  README.markdown  tests
build               composer.lock  piecrust.php      res
CHANGELOG.markdown  libs               src
root@localhost:/usr/local/piecrust-site#  cd bin
root@localhost:/usr/local/piecrust-site/bin# ls
chef  chef.cmd  chef.php (这里的/usr/local/piecrust-site/bin/chef就是主执行文件)
root@localhost:/usr/local/piecrust-site/bin# cd ..
root@localhost:/usr/local/piecrust-site# export PATH=$PATH:/usr/local/piecrust-site/bin
root@localhost:/usr/local/piecrust-site# echo 'export PATH=$PATH:/usr/local/piecrust-site/bin' >> /etc/profile
root@localhost:/usr/local/piecrust-site# chef init piecrust-blog (此命令会在当前目录下,生成piecrust-blog目录)
root@localhost:/usr/local/piecrust-site# cd piecrust-blog
root@localhost:/usr/local/piecrust-site/piecrust-blog# chef prepare post test-1 (这个是建立空帖子的命令。chef prepare page xxx是建立空页面的命令。)显示:
Creating new post: _content/posts/2013-11-03_test-1.html
root@localhost:/usr/local/piecrust-site/piecrust-blog# nano _content/posts/2013-11-03_test-1.html (编辑帖子的内容)
root@localhost:/usr/local/piecrust-site/piecrust-blog# chef bake -f (这个就是生成/更新静态网站的命令)
root@localhost:/usr/local/piecrust-site/piecrust-blog# ls
_cache  _content  _counter
root@localhost:/usr/local/piecrust-site/piecrust-blog# cd _counter
root@localhost:/usr/local/piecrust-site/piecrust-blog/_counter# ls
2013  2.html  index.html  _index.html.bak
root@localhost:/usr/local/piecrust-site/piecrust-blog/_counter#

可见/usr/local/piecrust-site/piecrust-blog/_counter就是静态网站的根目录。可绑域名到该目录。

root@localhost:/usr/local/piecrust-site/piecrust-blog/_counter# cd ..root@localhost:/usr/local/piecrust-site/piecrust-blog# ls
_cache  _content  _counter
root@localhost:/usr/local/piecrust-site/piecrust-blog# cd _content
root@localhost:/usr/local/piecrust-site/piecrust-blog/_content# ls
config.yml  pages  posts  templates
root@localhost:/usr/local/piecrust-site/piecrust-blog/_content# cd pages
root@localhost:/usr/local/piecrust-site/piecrust-blog/_content/pages# ls
_index.html  _index.html.bak (把/usr/local/piecrust-site/piecrust-blog/_content/pages/里原有的_index.html重命名为_index.html.bak,然后根据
https://github.com/ludovicchabant/PieCrust/blob/master/res/theme/_content/pages/_index.html的内容新建_index.html)
root@localhost:/usr/local/piecrust-site/piecrust-blog/_content/pages#


演示站点:http://pc.bright.biz.st
项目地址:https://github.com/ludovicchabant/PieCrust
https://github.com/ludovicchabant/PieCrust/issues/131        
https://bolt80.com/piecrust/