Robert Brook Hobix Tips

What is this, anyway?

This page is a completely unofficial digest of some of the useful tips that have begun to appear on the hobix-is-the-way mailing list. this isn’t the place to come to learn about Hobix. Come back when you’re up and running.

There’s a bit of an open secret in Hobix-land, and it’s this: Hobix is hard. It’s getting easier, but some of it is pretty complicated stuff. I don’t mean ‘now configure your database’ hard, I mean ‘get your head around’ hard. It’s sufficiently different from most other blogging software for that to be a bit of a problem. Which is fine be me, to be honest. I don’t think Hobix will ever take over much of the blogging world, but I think it’ll fill a pretty interesting niche.

And there’s the _why issue. Either you get it, or you don’t. Hey, I don’t even know if he’s a he. Might be Mena in drag.

Anyway. Early days and all that. And one last thing: although this site is generated using Hobix, it’s still me learning and breaking things. Please don’t take this site as a good example of what you can do with Hobix.

Well, get on with it then!

Ok. To start off, a quick rip of _why’s tips. I’ll clean all this up soon, I promise.

Using WEBrick to Serve Your Blogs

Hobix generates static HTML by default, so it’ll work with any web server.

For example, here’s a WEBrick server which will scan your ~/.hobixrc and setup a subdirectory for each one.

 #!/usr/local/bin/ruby
 require 'webrick'
 include WEBrick

 s = HTTPServer.new(
     :Port            => 2000,
     :DocumentRoot    => Dir::pwd + "/htdocs" 
 )

 ## mount subdirectories
 require 'hobix/config'
 require 'hobix/weblog'
 config = File.open( File.expand_path( "~/.hobixrc" ) ) { |f|
 YAML::load( f ) }
 config['weblogs'].each do |name, path|
     weblog = Hobix::Weblog.load( path )
     s.mount("/#{ name }", HTTPServlet::FileHandler, weblog.output_path)
 end

 trap("INT"){ s.shutdown }
 s.start
So, if you have a blog which you call ‘test’, it will appear at http://localhost:2000/test/. In order for this to work right, that URL needs to be added as the ‘link’ in that blog’s hobix.yaml file.

Using Quick Templates

The Quick template is simply ERb chunks, each chunk given a name in YAML. The names can then be used in other chunks by using the tag:

<+ name +>

To add an index page to your site that uses the default Quick template:

touch skel/index.html.quick

To add an entry page to your site that uses the default Quick template:

touch skel/entry.html.quick

Now, think about this. Index pages have several entries, but the entry pages only have one entry. How does Quick template know what to do?