bamboo

A blog engine on Hack http://github.com/nfjinjing/bamboo/tree/master

Latest on Hackage:2010.2.25

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow stackage.org to host generated Haddocks.

GPL licensed by Wang, Jinjing
Maintained by Wang, Jinjing

Bamboo: a blog engine on hack

Bamboo is a port of Panda, but runs on top of Hack. It's an experimental project but quite portable.

Note

The Bamboo codebase is a mess!!! But Haskell is so reliable that left me no incentive to do a rewrite.

So just use it, build middleware for it, or better yet write a new blog engine so everyone can benefit :)

Features

plain text as data source

db
|---- blog
|     |---- 08-09-01 first post
|     |---- 09-09-02 learn javascript.html
|
|---- tag
|     |---- programming
|     |---- funny
|
|---- static
      |---- About

simple config

blog_title    = C大调
blog_subtitle = 野猫不吃薯片
host_name     = jinjing.easymic.com
author_email  = nfjinjing@gmail.com

navigation    = About
per_page      = 7
sidebar       = Blogroll.md
favicon       = bamboo_icon.png

hacker friendly

  • posts are in plain text
  • SCM for publishing / data managing ( not really a feature, but a design goal from the beginning )
  • blindly follows the KISS principle from code to UI: be a simple blog, no more no less

modular

By it's middleware nature, bamboo could be used with other hack middleware to achieve extensibility; Bamboo plugins are also middleware, so they can be used not only in bamboo, but any other CMS like web application.

Demo

Easy install in 3 steps

1. update cabal

cabal update

2. install bamboo

cabal install happy
cabal install bamboo-launcher

3. run

mkdir myblog
cd myblog
bamboo

Bird view architecture

hack-interface :
  1. bamboo-hack-compatible-layer -- bamboo-controller -- bamboo-theme
  2. [ bamboo-plugins ]
  3. [ hack-middleware-stack ]

Customize

bamboo can be customized in 3 ways:

Theme

Theme is separated from the bamboo's controller, connected through an interface and a state.

Though theme could be pure, it has the type of

data Interface = 
    Index
  | IndexFeed
  | Post
  | Static
  | Tag
  | TagFeed
  | Search
  deriving (Show, Eq)

type Theme = Interface -> State -> IO Response

This makes theme creation a relatively complex task, since a theme author basically has to do everything: from html construction to model manipulation. But since state is passed purely and return type is in IO, it also provides the ultimate safety and flexibility to theme construction, something unmatched by any main stream web frameworks. Integrating twitter? no problem, do them in IO.

Plugin

Plugin is a proper hack middleware, so it works on an upper layer of the blog engine. It has all the power of a middleware, i.e. intercept request and response, and also the limitation, e.g. no idea of the underlying data structure of the app.

Plugin can be used to to do customization on the env object, or transformation to the response body. An example plugin is syntax highlighting, which could be done in the core, but would be more lightweight ( in terms of architecture design ) to be separated into a plugin.

You are hence not limited to use just bamboo-plugins to customize your blog, any hack-middleware which suite your need will do.

Javascript / CSS

In db/config/theme, you can customize precisely which js / css files to use, this allows client side customization and also lightweight configuration without compilation.

That's it

郑板桥(1693~1765) 修竹幽兰图

Changes

2010.25

Feature (in git repo)

  • add post in shell: scripts/mkentry.sh, thanks to Григорий Холомьёв
  • demo post receive hook update remote repo: scripts/post-receive

Fix

  • clean up deps

2010.1.1

Fix

  • fix 2010 date

2009.11.1

Fix

  • comment bug

2009.8.16

Fix

  • compatible with mps

2009.6.25

Fix

  • compatible with latest mps

2009.6.9

Feature

  • respect hack.script_name, this allows bamboo to be mounted in a sub path without configuration in site.txt

2009.6.8

Feature

  • completely separate view
  • new theme interface

2009.6.6

Feature

  • new architecture taking advantage of hack
  • -Wall -fno-warn-orphans clean

Fix

  • use   instead of  

2009.5.27

Fix

  • content-type for rss set to "application/rss+xml"
  • use strict bytestring in IO to release handle eagarly

2009.5.23

Feature

  • cached posts / static page for performance
  • cached most IO
  • use bytestring for performance ( 1.8 x increase )

Fix

  • properly update etag key for page, when tags are updated

2009.5.22

Fix

  • add missing model counter
  • note, I changed rss to strict == 3000.0.1, since happstack depends on HaXml 1.13 or something, which is not compatible with the latest rss package.

2009.5.19

Feature

  • for hack 5.19

2009.5.18.2

Fix

  • use renderHtml for strict html headers

2009.5.18.1

Fix

  • Add Type.Cache to cabal

2009.5.18

Feature

  • use tokyocabinet for caching
  • put use_cache = y in site.txt to enable
  • cache db will be in db/cache

2009.5.13

Feature

  • Add comment support

Fix

  • Compatible with mps 5.13
  • remove unnecessary dependencies

2009.4.52

Fix

  • Compatible with hack 4.52

2009.4.51

Fix

  • use Content Length in new hack-contrib

2009.4.50

Feature

  • Work with hack.contrib 4.50

2009.4.27

Feature

  • use new hack structure

2009.4.27

Feature

  • middleware should be in Main.hs too, so bamboo is just an other middleware that can be plugged into any webapp

2009.4.26

Feature

  • Handler is now configured at Main.hs

2009.4.25

Feature

  • Use hyena handler by default

2009.4.23

Feature

  • A pretty logger to stderr
  • Auto set content-size

2009.4.22

Feature

  • Panda ported to Hack, with a new name
comments powered byDisqus