Skip to content
CouchApp code used to run my blog http://caolanmcmahon.com
JavaScript
Find file
Latest commit 1377ad0 @caolan don't justify comment text
Failed to load latest commit information.
data first commit
files first commit
lib preload project images, fade out between page transitions and early u…
packages added properties package
static
templates add larger heading to about page too and remove texture from text of …
.gitignore update to latest apis and packages
README.md first commit
kanso.json update package name to work with current vhost settings

README.md

My blog

This is the CouchApp running at caolanmcmahon.com, and was an early experiment in using kanso.

Feel free to learn from or re-use the source code for your own blog, but please don't reproduce the design (css) or the content without my permission.

Running the code

First, install kanso:

git clone git://github.com/caolan/kanso.git
cd kanso
git submodule init
git submodule update
make && sudo make install

To deploy this code to a local CouchDB instance:

kanso push http://localhost:5984/blog

In production I use the minify and minify-attachments flags when pushing:

kanso push http://remote/blog --minify --minify-attachments

The data directory contains previous blog posts which were written using the old code (a static site generator using git). These can be added to the blog database we just created using the pushdata command:

kanso pushdata http://localhost:5984/blog data

For help using kanso, just type:

kanso help

If you find any bugs please let me know!

Structure

  • data - some old data I needed to migrate, you can ignore this
  • deps - vendor files used by my code in the lib directory
  • files - a dumping ground for my files on the web, you can ignore this
  • lib - the main application code, see app.js for how it fits together
  • static - static attachments: css, js, images etc
  • templates - dust templates used by the app

Replication and private drafts

I've added a filter function which allows me to replicate only published documents. Using this, I can have one public database which replicates with a private database. I can then author and view draft posts on the private database and have them automatically made available on the public site when published.

To set up continous replication with this filter, POST the following to /_replicate (replacing hostnames and database names as appropriate):

{
    "source": "http://hostname/blog_private",
    "target": "http://hostname/blog_public",
    "filter": "blog/published",
    "continuous": true
}

Deploying to older CouchDB instances (< 1.1.x)

I currently host this at couchone.com, and CouchDB 1.1 hasn't been released yet. On older versions of CouchDB kanso cannot detect the baseURL properly, which means if you wish to use rewrites you have to manually set the baseURL to an empty string when pushing the app:

kanso push http://username.couchone.com/blog --baseURL=""
Something went wrong with that request. Please try again.