Skip to content

brownbeagle/skinny_blog_engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Skinny Blog Engine

A minimalist blog engine for your Ruby on Rails site.

Usage

Posting

To post content, create a file in app/views/posts with post_ as a prefix to the filename.

Example

If you want to make a post called Hello World, you would create a file called app/views/posts/post_hello_world.html.erb and fill the file with the content of your blog post.

# app/views/posts/post_hello_world.html.erb
<h1>Hello World</h1>

<p>This is my first blog post using Blog Engine</p>

Any file in app/views/posts matching the pattern of post_* is considered a blog post.

Note that you can use whatever rendering engine your Rails installation supports: Erb, Haml, etc.

Posts Index

A default posts index view is provided, but you’ll probably want to override this. To do this you create your own app/views/posts/index.html.erb …

# app/views/posts/index.html.erb
<h1>My Awesome Blog</h1>

<ul>
  <% for post in @posts do %>
  <li><%= link_to post.title, post %> <%= post.updated_at %></li>
  <% end %>
</ul>

The Post class has the following public class methods: all, find(id). The all method will return an array of Post objects, ordered by most recent post first.

Post objects have the following attributes:

path - The path of the actual post file
id - The post name via the path. E.g. post_hello_world.html.erb is hello_world
*title - A humanized id.
*updated_at - Time the file was last updated according to File::mtime.
*created_at - Time the post was created.

You can override the attributes marked with * in the meta.yml file at app/views/posts/meta.yml

The format of the file is a simple Hash of key=>value pairs indexed by the blog post id. For example …

# app/views/posts/meta.yml
---
  'post1':
    created_at: <%= Date.new(2010, 2, 7)
  'post2':
    title: Brown Beagle Software

ATOM Feed

An ATOM index is built for you automatically as part of the plugin. You can reference the ATOM feed using posts_url(:format=>‘atom’) …

<link rel="alternate" type="application/atom+xml" title="Brown Beagle Software" href="<%= posts_url(:format=>'atom') %>" >

Show Post

There’s already a default posts/show action in the plugin that renders the post title, date, and content within your default layout. You can override this format easily by creating your own app/views/posts/show.html.erb

Here’s what the default app/views/posts/show.html.erb looks like …

# app/views/posts/show.html.erb
<h1><%= @post.title %></h1>
<h2><%= @post.updated_at.strftime('%d %B %Y') %></h2>
<%= render :file => 'posts/post_'+@post.id %>

TODO

There’s no support for comments, pingbacks, or trackbacks yet.

There’s also some hard coded file paths and ATOM values in there that I would like to remove eventually.

Credits

Blog Engine is maintained by Alex Pooley, and is funded by Brown Beagle Software.

License

Blog Engine is Copyright © 2009 Alex Pooley, Brown Beagle Software. It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.

Releases

No releases published

Packages

No packages published

Languages