GithubHelp home page GithubHelp logo

blog-caolan's Introduction

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=""

blog-caolan's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.