Total Pageviews

Wednesday 22 March 2017

搭建基于go的静态博客程序polo

先搭建go环境。

wget https://github.com/agonzalezro/polo/releases/download/v1.1.5/polo-linux-386
(若为64位系统,下载这个https://github.com/agonzalezro/polo/releases/download/v1.1.5/polo-linux-amd64)
mv  polo-linux-386 polo
chmod 755 polo

cd /usr/local
git clone https://github.com/agonzalezro/polo polo-site
cd polo-site

root@AR:/usr/local/polo-site# ls
Dockerfile  README.md          cmd      example       glide.yaml  utils
LICENSE     build-release.sh  config   file       site
Makefile    circle.yml          context  glide.lock  templates
root@AR:/usr/local/polo-site# cd example
root@AR:/usr/local/polo-site/example# ls
config.json  content 
root@AR:/usr/local/polo-site/example# nano config.json
(把paginationSize的值改为2)
root@AR:/usr/local/polo-site/example# ~/polo . output
(此即生成/更新静态网站的根目录的命令。意思是运行可执行文件~/polo,把当前目录的内容生成到output目录。在当前目录下,会生成output目录)
root@AR:/usr/local/polo-site/example#
root@AR:/usr/local/polo-site/example# cd output
root@AR:/usr/local/polo-site/example/output#
(/usr/local/polo-site/example/output目录里含有index.html,所以/usr/local/polo-site/example/output目录就是静态网站的根目录)

新建源帖:
root@AR:/usr/local/polo-site/example/output# cd ..
root@AR:/usr/local/polo-site/example# ls
config.json  content  output
root@AR:/usr/local/polo-site/example# cd content
root@AR:/usr/local/polo-site/example/content# nano test-1.md
root@AR:/usr/local/polo-site/example/content# cat test-1.md
date: 2017-03-21 22:38
tags: misc1, misc2, misc3
slug: test-1
author: brite

测试1
=====

这是测试1.

看看如何?

 (注意:测试1是标题,其下面的双线虚划线须跟标题是同样的长度.https://github.com/agonzalezro/polo页面里所写的那2个源帖格式有问题:发表后,内容显示不全!)
root@AR:/usr/local/polo-site/example/content# cd ..
root@AR:/usr/local/polo-site/example# ~/polo . output
root@AR:/usr/local/polo-site/example#

演示网站:http://apl.bright.biz.st/
项目地址:https://github.com/agonzalezro/polo
https://github.com/agonzalezro/polo/releases

If you want to build it yourself, I am using glide for the dependencies. This means that you will need to use Go 1.5 at least:
$ glide install

No comments:

Post a Comment