Lost in Code
This is my web site. The repo holds both the app that runs the site, as well as all of the blog posts I've written.
What blog software are you using?
I'm not using any software. I generally don't like the blog software that exists now: 1) for a simple web site, it's overkill, and 2) I'm kind of opinionated on the tools that I use. So what I have here is a very simple app I've built on top of Sinatra, everyone's favorite microframework for Ruby. I'm using Mustache for views, Sass for stylesheets, and CoffeeScript using an Ender package in place of jQuery. For asset packaging (concatenation and compression), I've integrated Jammit with Sinatra. There's no UI to create posts. Instead, they are written in Markdown and stored as text files within the repo, and these files are read from when a post is shown. I use Kramdown to make the Markdown-to-HTML conversion. This lets me use stuff like tables and tag elements with classes and so forth.
Where everything is
At one point I planned on having two kinds of content -- posts, i.e. temporal content, and pages, i.e. atemporal ("timeless") content. I now no longer expose a list of pages, but the distinction is still there.
That said, all of the posts I write are kept in data/posts/, and the pages are in data/pages/. Both work the same way in that there is a meta section at the top of every file followed by the content for that file. The meta section is treated as YAML, and the rest is treated as Markdown.
Most of the core code is in lib/lic/ -- the Sinatra application itself, as well as different components like Mustache and Kramdown.
Models are in lib/lic/models/. Because of the split, there are three models, Writing, Post, and Page. Writing is the superclass of Post and Page, and as such, has most of the code. Basically, here is where the files are read from data/ and parsed, and there are accessors for things like the title, body, summary, meta section, etc.
There are also presenters in lib/lic/presenters/ which wrap some of the models, in order to clean up the views a little bit.
Can I fork your repo and use it for my blog?
Yes! Fork it, make changes, do your thing. I'm not the first person to use Sinatra for my blog, I claim no intellectual property here.
So I cloned the repo, how do I start the app?
Okay, how do I hack on it?
Start the web server as described above, and in another tab, run
(c) 2012-2013 Elliot Winkler (email@example.com)
You are FREE to use any code here as you wish, whether for commercial or personal purposes. Just remember to have fun.
I am not responsible for any bad stuff that happens as a result of using this. It was probably your cat.
I am happy to answer any questions you have, feel free to email me using the address above.