Total Pageviews

Friday, 10 March 2017

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

首先搭建php环境。

curl -SOL https://phpoole.org/phpoole.phar
mv phpoole.phar /usr/local/bin/phpoole
chmod 755 /usr/local/bin/phpoole
(from https://github.com/PHPoole/PHPoole)

cd /usr/local
git clone https://github.com/PHPoole/PHPoole-demo phpoole-demo-site
cd phpoole-demo-site

root@AR:/usr/local/phpoole-demo-site# ls
README.md  build.php   composer.lock  deploy.sh  phpoole.yml  
composer.json  content layouts    static
root@AR:/usr/local/phpoole-demo-site# 
(现在,如果运行phpoole build ,会遇到提示:
Theme directory '/usr/local/phpoole-demo-site/themes/hyde/layouts' not found! )

root@AR:/usr/local/phpoole-demo-site# mkdir themes
root@AR:/usr/local/phpoole-demo-site# cd themes
root@AR:/usr/local/phpoole-demo-site/themes# git clone https://github.com/PHPoole/PHPoole-theme-hyde hyde
root@AR:/usr/local/phpoole-demo-site/themes# cd ..
root@AR:/usr/local/phpoole-demo-site# nano phpoole.yml
(把baseurl的值改为你所绑定的域名地址,我的是http://pp.bright.biz.st或者改成/也可。)
root@AR:/usr/local/phpoole-demo-site# phpoole build (此即生成/更新静态网站的根目录的命令)
root@AR:/usr/local/phpoole-demo-site# ls
README.md  build.php   composer.lock  deploy.sh  phpoole.yml  themes
_site   composer.json  content layouts    static
(生成了_site目录)
root@AR:/usr/local/phpoole-demo-site# cd _site
root@AR:/usr/local/phpoole-demo-site/_site# ls
404.html  apple-touch-icon-144-precomposed.png blog  favicon.ico  sitemap.xml
about   atom.xml css   index.html   tags
root@AR:/usr/local/phpoole-demo-site/_site#
(可见/usr/local/phpoole-demo-site/_site就是静态网站的根目录)

新建源帖:
root@AR:/usr/local/phpoole-demo-site/_site# cd ../content
root@AR:/usr/local/phpoole-demo-site/content# ls
404.md about.md  atom.md  blog  sitemap.md
root@AR:/usr/local/phpoole-demo-site/content# cd blog
root@AR:/usr/local/phpoole-demo-site/content/blog# nano test-1.md
root@AR:/usr/local/phpoole-demo-site/content/blog# cat test-1.md
---
title: 测试1
date: 2017-03-10 22:12:00
tags: misc
---

这是测试1.

看看如何?
root@AR:/usr/local/phpoole-demo-site/content/blog# cd ../..
root@AR:/usr/local/phpoole-demo-site# phpoole build

演示网站:http://pp.bright.biz.st/, http://pp.bright.biz.st/blog/ 
(或者http://ccl.bright.biz.st,http://ccl.bright.biz.st/blog/)
项目地址:https://github.com/PHPoole/PHPoole
https://github.com/PHPoole/PHPoole-demo 
(或者https://github.com/PHPoole/Cecil,或者https://github.com/Narno/phpoole-cecil-demo)
https://github.com/PHPoole/PHPoole-theme-hyde

2017-03-13号,程序作者通知我“PHPoole-theme-hyde include pagination logic by default.”,程序作者更新了PHPoole-theme-hyde代码,提供了分页支持。PHPoole-theme-hyde代码默认5个帖子/页。如果你想改为3个帖子/页,请修改配置文件phpoole.yml:
这一行“paginate:”的下一行加上:
        max: 3
参见 https://github.com/PHPoole/PHPoole-demo/issues/4,
https://phpoole.org/documentation/4-configuration/
 https://github.com/PHPoole/PHPoole-demo/blob/master/phpoole.yml
 
如果你在2017-03-13号之前 
----------------


cd /usr/local
git clone https://github.com/Narno/arnaudligny.fr
cd arnaudligny.fr
root@AR:/usr/local/arnaudligny.fr# ls
LICENSE   composer.lock  layouts      validator.php
README.md   build.php       content      phpoole.yml
_prose.yml  composer.json  deploy.sh      static
root@AR:/usr/local/arnaudligny.fr# nano phpoole.yml
(把baseurl的值改为你所绑定的域名地址,我的是http://alf.bright.biz.st或者改成/也可。)
root@AR:/usr/local/arnaudligny.fr# phpoole build (此即生成/更新静态网站的根目录的命令)
root@AR:/usr/local/arnaudligny.fr# ls
LICENSE     _site       composer.lock  layouts      validator.php
README.md   build.php       content      phpoole.yml
_prose.yml  composer.json  deploy.sh      static
(生成了_site目录)
root@AR:/usr/local/arnaudligny.fr# cd _site
root@AR:/usr/local/arnaudligny.fr/_site# ls
404.html         LICENSE  css         robots.txt   sitemap.xml
CNAME             README   index.html     rss.xml      tags
CV_ArnaudLigny-2016.pdf  blog      manifest.json  screenshots
(可见/usr/local/arnaudligny.fr/_site就是静态网站的根目录)
 root@AR:/usr/local/arnaudligny.fr/_site#  

新建源帖:
root@AR:/usr/local/arnaudligny.fr/_site# cd ../content/blog
root@AR:/usr/local/arnaudligny.fr/content/blog# nano test-1.md
root@AR:/usr/local/arnaudligny.fr/content/blog# cat test-1.md
---
title: 测试1
date: 2017-03-10 22:09:00
tags: misc
---

这是测试1.

看看如何?

root@AR:/usr/local/arnaudligny.fr/content/blog# cd ../..
root@AR:/usr/local/arnaudligny.fr# phpoole build
演示网站:http://alf.bright.biz.st, http://alf.bright.biz.st/blog/
项目地址:https://github.com/Narno/arnaudligny.fr, 这个项目不错,支持分页。
-------------

cd /usr/local
git clone https://github.com/Narno/narno.com
cd narno.com

root@AR:/usr/local/narno.com# ls
LICENSE    _prose.yml  build.php      composer.lock  deploy.sh    phpoole.yml
README.md  composer.json  content         layouts    static
root@AR:/usr/local/narno.com#  nano
phpoole.yml
(把baseurl的值改为你所绑定的域名地址,我的是http://nnc.bright.biz.st或者改成/也可。)
root@AR:/usr/local/narno.com# phpoole build
root@AR:/usr/local/narno.com# ls
LICENSE    _prose.yml  build.php      composer.lock  deploy.sh    phpoole.yml
README.md  _site       composer.json  content         layouts    static
root@AR:/usr/local/narno.com# cd _site

root@AR:/usr/local/narno.com/_site# ls
404.html              icon-250x250.png
CNAME                  icon-300x300.png
LICENSE                  icon-48x48.png
README                  icon-72x72.png
a-propos              icon-96x96.png
apple-touch-icon-precomposed.png  icon.png
apple-touch-icon.png          images
apple-touch-startup-image.png      index.html
blog                  manifest.webmanifest
configpc              msapplication-square310x310logo.png
contact                  photos
css                  robots.txt
favicon.ico              rss.xml
favicon.png              sitemap.xml
icon-144x144.png          sw.js
icon-168x168.png          tags
icon-192x192.png
root@AR:/usr/local/narno.com/_site#  

(可见/usr/local/narno.com/_site就是静态网站的根目录)

新建源帖:
root@AR:/usr/local/narno.com/_site# cd ../content/blog
root@AR:/usr/local/narno.com/content/blog# nano test-1.md

root@AR:/usr/local/narno.com/content/blog# cat test-1.md
---
date: 2017-03-11 16:45:00
title: 测试1
tags:
  - misc1
  - misc2
---

这是测试1.

看看如何?

root@AR:/usr/local/narno.com/content/blog# cd ../..

root@AR:/usr/local/narno.com# phpoole build

演示网站:http://nnc.bright.biz.st/,http://nnc.bright.biz.st/blog/
项目地址:https://github.com/Narno/narno.com, 这个项目也不错,支持分页。

No comments:

Post a Comment