Giter VIP home page Giter VIP logo

gor's Introduction

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].

gor's People

Contributors

balupton avatar draychou avatar hugozhu avatar ifq avatar nareix avatar nulijiabei avatar prisoner avatar sepher avatar snaigle avatar wendal avatar wheelcomplex avatar xvweirong avatar ywjno avatar zerob13 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gor's Issues

不支持相对引用

我有文件a.md和b.md,a.md中bbb这样编译出来并没有引用到b.html,希望这个处理下.

config文件中加入date_format选项

现在的data的format是yyyy-MM-dd hh:mm:ss这样的格式,能不能添加有关于data的format选项让人自己设置(比如支持MM-dd-yyyy hh:mm这样的)

目前只支持markdown格式么?html可以不?

如题,我有一些旧的博客是从百度博客上导出来的 html。
之前在octopress下边,html也可以用来生成博客。我试了下gor好像不行,不知道有没有什么简单的方法能支持下?

layout渲染可能存在问题

https://github.com/douo/douo.ruhoh.com/tree/master/themes/moon

用了一下这个皮肤,然后在papers/index.html处使用了
layout: home
home: 1
直接在compile的时候报错空指针:

panic: interface conversion: interface is nil, not *gor.DocContent

goroutine 1 [running]:
github.com/wendal/gor.RenderInLayout(0xf84012e000, 0x65d, 0xf840092c20, 0xf800000004, 0xf84007bda0, ...)
    /usr/local/go/src/pkg/github.com/wendal/gor/compile.go:129 +0x212
github.com/wendal/gor.Compile(0x7fff5fbffa84, 0xf800000007)
    /usr/local/go/src/pkg/github.com/wendal/gor/compile.go:87 +0xdff
main.main()
    /usr/local/go/src/pkg/github.com/wendal/gor/gor/gor.go:64 +0x50d

goroutine 2 [syscall]:
created by runtime.main
    /usr/local/go/src/pkg/runtime/proc.c:221

每次compile的结果不一样

我的博客每次compile的时候会产生很多文件的改动,按说只有新写的那篇改动才对。
diff一下可以看到, 很多文件的改动类似这样

@@ -951,10 +953,10 @@

     <li><span>2006-12-21</span> &raquo; <a href="/blog/2006/12/21/2006-12-21-1/">后天考6级,又要给国家做贡献了...</a></li>

-    <li><span>2006-12-16</span> &raquo; <a href="/blog/2006/12/16/2006-12-16-3/">工作终于搞定了,可以轻松一下了</a></li>
-  
     <li><span>2006-12-16</span> &raquo; <a href="/blog/2006/12/16/2006-12-16-1/">触电可分为哪几种情况</a></li>

+    <li><span>2006-12-16</span> &raquo; <a href="/blog/2006/12/16/2006-12-16-3/">工作终于搞定了,可以轻松一下了</a></li>
+  
     <li><span>2006-12-16</span> &raquo; <a href="/blog/2006/12/16/2006-12-16-2/">太阳耀斑爆发出现大磁暴 已影响全国的短波通讯</a></li>

好像是那些一天之类多篇博客的地方会出现这种 next/prev 链接的变化。每次compile的结果不一致,虽然差异很小,但是也不利于管理。

我想应该和 map 的遍历有关吧。应该按固定顺序来输出。

一直搞不明白payload是什么意思?

实在不好意思,问了这么一个比较傻的问题,不过我确实没整明白,这个payload的是干嘛的……网上查了一圈也感觉不太对……可否不吝赐教……

Ruhoh 2.1

Do you have a plan to support Ruhoh 2.* ?

CommentsWidget增加友言支持吧

// 其他的,想不到还有啥,哈哈,需要其他的就报个issue吧
return nil, errors.New("CommentsWidget Only for disqus yet")

lz代码里,嘿嘿。。。。

针对天朝特色,可以考虑支持友言,**版的disqus,顺便增加下“加网”提供一键式站外分享^_^

图片在哪儿?

我把图片放到 media 里面,然后 gor http,但是访问 http://localhost:8080/media/a.png 就 404 not found 啊。

能不能清楚的描述下呢?

the zip file in new.go

Hello, I am wondering why did you use the const INIT_ZIP rather than read from the zip file?

不支持忽略无关文件

例如有a.md文件,其中图片引用了当前目录的xx.jpg,结果编译的时候xx.jpg停止了,应该忽略掉这些不属于markdown的文件

代码高亮有问题

最近博客页面代码高亮有问题:行号,高亮都没有显示。代码能加载出来

环境:Ubuntu 12.04 下chrome, firefox情况一样,麻烦作者看一下

gor使用什么许可证?

我建立一个gor的分支,但是代码我改动比较大,似乎不太合适跟gor合并,我想知道我能不能独立出来呢?

404 page not found

我用 gor new example.com 创建项目,然后执行 gor http 开启项目,结果打开地址提示: 404 ,哪里出错呢?

博客中方便插入图片的方法

今天刚发现gor这个好东东,来支持一下。
之前用octopress,但是导入之前的博客后,几百篇博客每次生成都很慢,今天又一次想解决的时候,搜到这里来了。简单配置了下,觉得gor挺简洁。

想问下,gor下有没有什么方法快速插入图片的?请教下作者写博客是怎么样实现的?也是手动cp图片到制定文件夹,然后在markdown里添加link么?我翻了下,你的博客图片是按日期存放的,请问是自动的吗?

页内链接跳转

测试了这个Markdown文档
就在README.md里面。点击 Table of Contents段落中的目录,可以直接跳转到对应的段落。
在本地使用Gor编译后,点击目录无法跳转到对应段落。

widgets

widgets 对应的 layout 在哪里?难道写死到 go 代码里了?

你还真写死在代码里面啦,这个不是应该单独拿出来的吗?

如何修改8080端口

我vps上的8080端口已被占用:

as3:# gor http
2013/08/28 04:09:36 gor.go:25: gor ver 2.4
2013/08/28 04:09:36 gor.go:78: Listen at :8080
2013/08/28 04:09:36 gor.go:79: listen tcp :8080: address already in use
as3:
#

如何修改8080端口?以使得运行gor http后能看到预览效果?

重构gor的代码

现在的代码, 大量的基于map[string]interface{} 各种混乱的调用

gor命令增加提示帮助,类似输入go的时候提示

输入go的提示如下:

➜ ~ go
Go is a tool for managing Go source code.

Usage:

go command [arguments]

The commands are:

build       compile packages and dependencies
clean       remove object files
doc         run godoc on package sources
env         print Go environment information
fix         run go tool fix on packages
fmt         run gofmt on package sources
get         download and install packages and dependencies
install     compile and install packages and dependencies
list        list packages
run         compile and run Go program
test        test packages
tool        run specified go tool
version     print Go version
vet         run go tool vet on packages

安装失败

cat $GOROOT
cat: /usr/local/go: Is a directory

cat $GOPATH
cat: /Users/Ray/Workspace/sandbox/go: Is a directory

go get -u github.com/wendal/gor 执行成功 然后执行go install github.com/wendal/gor/gor 报错
go install github.com/wendal/gor/gor
go install github.com/wendal/gor/gor: open /usr/local/go/bin/gor: permission denied

以为是权限问题 然后添加sudo执行报错为:
sudo go install github.com/wendal/gor/gor
can't load package: package github.com/wendal/gor/gor: cannot find package "github.com/wendal/gor/gor" in any of:
/usr/local/go/src/pkg/github.com/wendal/gor/gor (from $GOROOT)
($GOPATH not set)

#42 的尾巴,部分文件生成的记过每次不一样

#42 解决了每篇post里边连接可能不一样的问题,但是还有以下几个文件还有同样的问题。即使不改变内容,重新compile以下几个文件就不一样。

#
#   modified:   categories/index.html
#   modified:   rss.xml
#   modified:   tags/index.html
#

rss.xml 只是变时间戳,这个应该是正常的。

diff --git a/categories/index.html b/categories/index.html
index 58ffd40..6066397 100755
--- a/categories/index.html
+++ b/categories/index.html
@@ -88,23 +88,23 @@
 <ul class="tag_box inline">

   <li>
-  <a href="/categories/#woodworking-ref">woodworking <span>15</span></a>
+  <a href="/categories/#legacy-ref">legacy <span>279</span></a>
 </li>

   <li>
-  <a href="/categories/#octopress-ref">octopress <span>2</span></a>
+  <a href="/categories/#binary-ref">binary <span>12</span></a>
 </li>

   <li>
-  <a href="/categories/#IEEE802.11-ref">IEEE802.11 <span>1</span></a>
+  <a href="/categories/#orgmode-ref">orgmode <span>2</span></a>
 </li>
diff --git a/tags/index.html b/tags/index.html
index c9798ab..71eb850 100755
--- a/tags/index.html
+++ b/tags/index.html
@@ -104,7 +104,7 @@
 </li>

   <li>
-  <a href="/tags/#alaskan-sawmill-ref">alaskan sawmill <span>1</span></a>
+  <a href="/tags/#gor-ref">gor <span>1</span></a>
 </li>

   <li>
@@ -124,7 +124,7 @@
 </li>

   <li>
-  <a href="/tags/#gor-ref">gor <span>1</span></a>
+  <a href="/tags/#alaskan-sawmill-ref">alaskan sawmill <span>1</span></a>
 </li>

Markdown文档【图片+链接】编译失败

测试了这个Markdown文档
就在README.md里面第2行,
原文如下:

[![Build Status](https://travis-ci.org/scripted-editor/scripted.png?branch=master)](https://travis-ci.org/scripted-editor/scripted)

如果正确编译,应该看到是一个图片,带有URL --> Build Status
Gor里面无法正常编译, 编译完,Web页面显示:

![Build Status](https://travis-ci.org/scripted-editor/scripted.png?branch=master)

上面这段是有正确链接的。 说明编译器正确处理了超链接编译,但没有想到这个链接的正文本身又是一个Markup,也需要编译。

不支持域名+路径

我在production_url里面设置abc.com/blog
生成出来的页面会有路径问题

比如说所有的素材都会拷贝在根目录 和blog平级
而twitter的一些CSS引用却到/blog/下面去找 就找不到了

Gor是不是目前暂时不支持域名+路径?

gor new 生成目录不对

gor new astaxie.github.com
2013/01/09 22:44:02 new.go:28: Download init content zip
2013/01/09 22:44:08 new.go:43: Downloading init content zip
2013/01/09 22:44:09 new.go:56: Unpack init content zip
2013/01/09 22:44:09 new.go:82: Done

然后生成的目录是new,不是astaxie.github.com

好像不能生成RSS?

没有RSS不方便啊。
新手,因为win的机器不好弄ruby环境所以尝试这个gor.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.