• Stars
    star
    599
  • Rank 74,272 (Top 2 %)
  • Language
    Go
  • Created over 11 years ago
  • Updated about 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Golang编写的静态博客引擎

Table of Contents

Sites using gor

正在使用Gor的博客

When Go meets Raspberry Pi

RaymondChou's Blog

visualfc's blog

wendal随笔

一个热爱木工的软件工程师

AmicusLuyang

Dray's Home

努力加贝

腾达格尔的博客

阿泉来咧 赵金泉的个人网站

风笑痴

Nareix

Wchin

王浩的小课桌

leonardyp

Forks 的代码工坊

Linux使用实例

树莓派来咧

If you are also using gor, please don't hesitate to tell me by email or open an issue. 如果也在使用,欢迎email或者开个issue告诉我们哦

English Introduction

gor -- A static websites and blog generator engine written in Go

===

Transform your plain text into static websites and blogs. gor is a Ruhoh like websites and blog generator engine written in Go. It's almost compatible to ruhoh 1.x specification. You can treat gor as a replacement of the official implementation what is written in Ruby.

Why reinvent a wheel? gor has following awesome benefits:

  1. Speed -- Less than 1 second when compiling all my near 200 blogs on wendal.net
  2. Simple -- Only one single executable file generated after compiling, no other dependence

Installation

==================== To install:

go get -u github.com/wendal/gor
go install github.com/wendal/gor/gor

If you use brew on Mac, and you didn't set $GOROOT and $GOPATH environment variable Please using this command:

ln -s /usr/local/Cellar/go/1.0.3/bin/gor /usr/local/bin

Or to download a compiled one directly from Googe Code

Quick Start

======================

Create a new website

gor new example.com
cd example.com
# After execution, a folder named example.com will be generated, including a scaffold & some sample posts.

Create a new post

gor post "goodday" [dir/to/img/files]
# generate a new post file: post/goodday.md, open it with your markdown editor to write.

dir/to/img/files is optionl. If it's provided, all files in that dir will be copy into blog dir(configurable dir), and insert <img> tag into post file.

Configuration

Open the site.yml file in root folder

  1. Input title, author etc.
  2. Input email etc.

Open the config.yml file in root folder

  1. production_url is your website address, such as http://wendal.net, don't add '/' at last, it will be used to generate rss.xml etc.
  2. summary_lines is the length of abstract on homepage, any number as you like.
  3. latest is how many posts will be shown on homepage
  4. imgs parts is auto img config
    • imgtag:basic format for tag to be insert. the %s part will to replaced by urlperfix/post_name/img_file_name
    • urlperfix:img file url perfix
    • localdir:location inside blog repo for img file storage

Open widgets folder, you can see some widgets here, there is a config.yml file of each widget for configuration.

  1. analytics only support google analytics by now, please input tracking_id here
  2. comments only support disqus by now, please input your short_name of disqus here
  3. google_prettify for code highlighting, normally it's not necessary to change

Compile to generate static web page

gor compile
# Finished instantly. A new folder named compiled will be generated, all website is in it.

Local preview

gor also comes with a built-in development server that will allow you to preview what the generated site will look like in your browser locally.

gor http
# Open your favorite web browser and visit: http://127.0.0.1:8080

Deployment

You can deploy it to GitHub Pages, or put it to your own VPS, because there are only static files(HTML, CSS, js etc.), no need of php/mysql/java etc.

Chinese Introduction

gor -- Golang 编写的静态博客引擎

===

gor是使用 Go 实现的类 Ruhoh 静态博客引擎(Ruhoh like),基本兼容 ruhoh 1.x 规范。 相当于与 ruhoh 的官方实现( ruby 实现),有以下优点:

  1. 速度完胜 -- 编译 wendal.net 近200篇博客,仅需要1秒
  2. 安装简单 -- 得益于 golang 的特性,编译后仅一个可运行程序,无依赖

Installation 安装

==================== To install:

go get -u github.com/wendal/gor
go install github.com/wendal/gor/gor

在 Mac下使用 brew 的用户

如果是通过 brew 来安装go,并且没有设置$GOROOT$GOPATH的话,请使用如下命令(路径请更改为自己对应的 golang 的版本信息)

ln -s /usr/local/Cellar/go/1.0.3/bin/gor /usr/local/bin

或者你可以从 Googe Code 直接下载编译好的gor

Quick Start 快速入门

======================

新建站点

gor new example.com
# 执行完毕后, 会生成example.com文件夹,包含基本素材及演示文章

新建单篇博客

cd example.com
gor post "goodday" [dir/to/img/files]
# 即可生成 post/goodday.md文件,打开你的markdown编辑器即可编写

如果输入可选参数 dir/to/img/files,gor 会从该目录拷贝图片文件到配置的目录,同时在 goodday.md 中自动插入对应的 <img> 标签。

基本配置

打开站点根目录下的site.yml文件

  1. 填入 title,作者等信息
  2. 填入邮箱等信息

打开站点根目录下的 config.yml 文件

  1. production_url:为你的网站地址,例如http://wendal.net最后面不需要加入/,生成rss.xml等文件时会用到
  2. summary_lines:首页的文章摘要的长度,按你喜欢的呗
  3. latest:首页显示多少文章
  4. imgs:自动插入<img>的相关配置
    • imgtag:要插入的 标签的基本格式,%s 部分会被自动替换为 urlperfix/post_name/img_file_name 的格式
    • urlperfix:图片地址前缀
    • localdir:图片文件在博客内的本地存放目录

打开widgets目录, 可以看到基本的挂件,里面有config.yml配置文件

  1. analytics:暂时只支持google analytics,填入tracking_id
  2. comments:暂时只支持disqus,请填入short_name
  3. google_prettify:代码高亮,一般不修改

编译生成静态网页

gor compile
# 瞬间完成,生成 compiled 文件夹,包含站点所有资源

本地预览

gor http
# 打开你的浏览器,访问 http://127.0.0.1:8080

部署

你可以使用github pages等服务,或者放到你的自己的vps下,因为是纯静态文件,不需要php/mysql/java等环境的支持

Copyright and License

This project is licensed under the BSD 3 Clause License.

Copyright (C) 2013, by WendalChen [email protected].

More Repositories

1

nutz-book-project

做个平台
JavaScript
229
star
2

nutz-book

Nutz Book
72
star
3

shortit

超简单的短地址服务
JavaScript
66
star
4

goweixin

Go
27
star
5

android_su

Just as root !! Simple su for android , without any Management (Not GUI Confirm).
Makefile
23
star
6

alipay-sdk

请使用 https://github.com/alipay/alipay-sdk-java-all 把支付宝的SDK导入成maven库
Java
19
star
7

wzflow

NutzWk 1.x 集成 activiti的demo
JavaScript
14
star
8

goyaml2

YAML for Golang
Go
14
star
9

gsnap

Linux截图(原始代码从Taobao的TMTS项目导入)
C
14
star
10

teclast_tools

Lua
13
star
11

errors

增强型errors包(for golang)
Go
11
star
12

wendal

10
star
13

lua-newlisp

eval newLISP in lua
C
8
star
14

nutzdoc

Java
7
star
15

yeelink_tester

Yeelink 测试GUI
Python
6
star
16

viv

基于Nutz和BuguMongodb的,使用Mongodb作为持久层的Issue管理系统
Java
5
star
17

nutz-now

打算做个系列视频,或者文本教程
4
star
18

lua4cn

Lua源码中文注释
C
4
star
19

bfr

nonblocking 8-bit-clean pipe buffer, 原代码所在网址: http://archive.ubuntu.com/ubuntu/pool/universe/b/bfr/bfr_1.6.orig.tar.gz
C
4
star
20

cramfs

经过修改,容错能力更好的cramfs-tools
C
4
star
21

nutztb

推爸!! --> Nutz做的微博系统
JavaScript
4
star
22

xt804-spinet

把Air601/W800当网卡用, SPI/SDIO接口, 适用于xt804系列的所有芯片,例如Air101/Air103/W800/W803
Lua
4
star
23

luat-demos

非官方luat的demo集合,更多更全,集成度更高
Lua
3
star
24

rk2918_uzone_f0_top

优择F0领先版的内核源码 By Wendal
C
3
star
25

httpsqs4py

Httpsqs Python客户端
Python
3
star
26

luatos-lib-dnsclient

DNS客户端 for LuatOS
Lua
3
star
27

luatos-lib-aliyun2

新的阿里云物联网适配库 for LuatOS
Lua
2
star
28

log2mongodb

Java
2
star
29

xplay.io

CSS
2
star
30

nutzdiff

Java
2
star
31

wendal.net

我的博客
CSS
2
star
32

luatos-bemfa

LuatOS 集成 巴法云
Lua
2
star
33

logviewer

查看Log的工具
Java
2
star
34

whale

吞掉一切数据
Java
2
star
35

go-air

最强大,最简洁的go模块,一行代码完成全部功能!!
Go
2
star
36

vTest

一个轻便的Test平台
JavaScript
2
star
37

tornado-learn

Python
2
star
38

learn-newLISP

学习newLISP
2
star
39

luatos-lib-zstruct

C风格的struct库 for LuatOS
Lua
2
star
40

luatos-lib-ntrip

ntrip协议客户端
Lua
2
star
41

Luat_FatFS

集成FatFS到Luat,使其支持读写SD卡
1
star
42

luatos-lib-uc6228

芯与物UC6228CI卫星导航芯片 for LuatOS
Lua
1
star
43

luatos-lib-at6558r

中科微AT6558R卫星导航芯片 for LuatOS, 适合Air530Z/Air530Z-BD及其他基于AT6558R的GNSS模组
Lua
1
star
44

luatos-demo-uart

LuatOS里UART相关的扩展demo
1
star
45

luatos-lib-wifiloc

wifi定位 for LuatOS (非官方库,个人测试用)
Lua
1
star
46

c_crypto

用cgo实现golang的crypto包, 内置的crypto包实在太慢了
Go
1
star
47

yeelink4j

yeelink java client
Java
1
star
48

miniquic

Make a Minimal implementation of QUIC, in C99
1
star
49

learn-tea

学习TVM
1
star
50

oauth2

OAuth2 in Java
1
star
51

luatos-lib-qqlbs

腾讯智能硬件定位(基站定位/wifi定位/蓝牙定位) for LuatOS
Lua
1
star
52

luatos-lib-onenetcors

OneNet的单频RTK对接(MQTT播发) for LuatOS
1
star
53

flashtoolcli4ec

把移芯方案的FlashToolCLI封装成脚本调用
Python
1
star