Colophon
This site is a Parklife/Sinatra static site hosted on GitHub Pages, it’s open source and contributions are welcome and appreciated.
I chose Sinatra because it provides an awful lot of useful functionality out-of-the-box and its concise syntax makes it incredibly easy to make a fully-working website – the whole app is basically one file with very few lines of code.
I wrote Decant because it’s what was missing from my Parklife party – easy frontmatter-aware access to a directory of content files (Markdown in this case). Here’s how it’s used in this site:
# Define a model-like class to wrap the content.
Page = Decant.define(dir: 'content', ext: 'md') do
# Declare a frontmatter convenience reader.
frontmatter :title
end
# Now find the page and work with it.
page = Page.find('colophon')
page.content # => "Colophon\n\nThis site is a"...
page.frontmatter # => {:title=>"Colophon"}
page.title # => "Colophon"
Markdown is handled by Kramdown with syntax-highlighting by Rouge styled by Pygments. I added support for GitHub-style alert callouts by extending Kramdown.
Here are the different alert types (for development/debugging), the icons are from Heroicons: