Total Pageviews

Saturday, 26 November 2016

搭建基于python的静态博客程序grow


easy_install -U distribute
pip install grow

cd /usr/local
git clone https://github.com/growthemes/base grow-base-site
cd grow-base-site

root@AR:/usr/local/grow-base-site# ls
content    dist  podspec.yaml  README.md  source  views
root@AR:/usr/local/grow-base-site#  grow build (这就是生成/更新静态网站的根目录的命令)
root@AR:/usr/local/grow-base-site# ls
build  content    dist  podspec.yaml  README.md  source  views
(生成了build目录)
root@AR:/usr/local/grow-base-site# cd build
root@AR:/usr/local/grow-base-site/build# ls
about   index.html  sitemap.xml
assets projects
root@AR:/usr/local/grow-base-site/build#
(可见/usr/local/grow-base-site/build就是静态网站的根目录,你可绑定域名到该目录)

新建源帖:
root@AR:/usr/local/grow-base-site/build# cd ..
root@AR:/usr/local/grow-base-site# ls
build  content    dist  podspec.yaml  README.md  source  views
root@AR:/usr/local/grow-base-site# cd content
root@AR:/usr/local/grow-base-site/content# ls
pages
root@AR:/usr/local/grow-base-site/content#  cd pages
root@AR:/usr/local/grow-base-site/content/pages# nano test-1.md
root@AR:/usr/local/grow-base-site/content/pages# cat test-1.md
---
$title: 测试1
$order: 3
description: abc
---

这是测试1.

看看如何?

(/usr/local/grow-base-site/content/pages/里的about.md 和projects.md的$order的值分别为1和2,因此test-1.md的$order的值就设为3,以后的帖子的$order的值就相应的设为4,5,6.。。。)
root@AR:/usr/local/grow-base-site/content/pages#
root@AR:/usr/local/grow-base-site/content/pages# cd ../..
root@AR:/usr/local/grow-base-site# grow build

演示网站:http://gbs.bright.biz.st/
项目地址: https://github.com/grow/grow,
 https://github.com/growthemes/base

其他的变种1的搭建
cd /usr/local
git clone https://github.com/grow/grow.io
cd  grow.io

root@AR:/usr/local/grow.io# ls
content    podspec.yaml  README.md  source  static  translations  views
root@AR:/usr/local/grow.io#  grow build
root@AR:/usr/local/grow.io# ls
build  content    podspec.yaml  README.md  source  static  translations  views
root@AR:/usr/local/grow.io# cd build
root@AR:/usr/local/grow.io/build# ls
404.html  docs    index.html  project  search  start  static  themes
root@AR:/usr/local/grow.io/build#
(可见/usr/local/grow.io/build就是静态网站的根目录)

新建源帖:
root@AR:/usr/local/grow.io/build# cd ../content/codelab
root@AR:/usr/local/grow.io/content/codelab# nano 10.md
root@AR:/usr/local/grow.io/content/codelab# cat 10.md
---
$title: 测试1
$order: 10
---

这是测试1.

看看如何?

root@AR:/usr/local/grow.io/content/codelab# cd ../..
root@AR:/usr/local/grow.io# nano content/pages/index.html
(在第二个"---"的下一行加上:
<center>pls read my posts: http://gi.bright.biz.st/start/10/</center> )
root@AR:/usr/local/grow.io#  grow build

演示网站:http://gi.bright.biz.st,
http://gi.bright.biz.st/start/10
项目地址:https://github.com/grow/grow,
https://github.com/grow/grow.io


 变种2的搭建
 cd /usr/local
git clone https://github.com/growthemes/codelab grow-codelab-site
cd grow-codelab-site

root@AR:/usr/local/grow-codelab-site# ls
content    dist  podspec.yaml  source  translations  views
root@AR:/usr/local/grow-codelab-site# grow build
root@AR:/usr/local/grow-codelab-site# ls
build  content    dist  podspec.yaml  source  translations  views
root@AR:/usr/local/grow-codelab-site# cd build
root@AR:/usr/local/grow-codelab-site/build# ls
404.html  about-us  archive  de  index.html  ja  posts    static    the-team  zh
root@AR:/usr/local/grow-codelab-site/build#
(可见/usr/local/grow-codelab-site/build就是静态网站的根目录)

新建源帖:
root@AR:/usr/local/grow-codelab-site/build# cd ../content/posts
root@AR:/usr/local/grow-codelab-site/content/posts#
root@AR:/usr/local/grow-codelab-site/content/posts# cat 2016-11-26-test-1.md
---
$title@: test1
$dates:
  published: 2016-11-26 10:01
---

这是测试1.

(以上的标题不能写为中文,否则下面build时,会遇错)
root@AR:/usr/local/grow-codelab-site/content/posts# cd ../..
root@AR:/usr/local/grow-codelab-site# grow build

演示网站:http://grow.bright.biz.st,http://grow.bright.biz.st/archive/
项目地址:https://github.com/grow/grow
https://github.com/growthemes/codelab