= Divan = Divan is a simple blogging platform that is [source:trunk/examples/divan included] with Diva as an example application. It uses [http://incubator.apache.org/couchdb/ CouchDB] (via the [http://code.google.com/p/couchdb-python/ CouchDB-Python] library) for storage. It supports comments with [http://openid.net/ OpenID authentication], [http://hixie.ch/specs/pingback/pingback-1.0 pingbacks], [http://atomenabled.org/ Atom feeds] for the whole blog, individual categories, and comments, and the [http://atomenabled.org/developers/protocol/ Atom publishing protocol]. It does not provide a HTML-based interface for authoring entries, nor does it support the XML-RPC based !MetaWeblog API. == Configuration Options == In addition to the core Diva [ConfigOptions options], Divan can be customized using the following options: `blog_author`:: Name of the author of the blog `blog_author_email`:: Email address of the blog author `blog_title`:: Name of the blog `db_uri`:: URI of the CouchDB database `media_dir`:: Path to a local directory where media resources (managable via !AtomPub) are stored. If not set, media collection management is not provided. == CouchDB Views == [[PageOutline(3-4, Views)]] All views are in Javascript. === `_design/posts` === ==== `by_month` ==== {{{ #!javascript function(doc) { if (doc.type == 'Post') { var year = parseInt(doc.published.substr(0, 4), 10); var month = parseInt(doc.published.substr(5, 2), 10); emit([year, month, doc.published], { slug: doc.slug, title: doc.title, author: doc.author, summary: doc.summary, published: doc.published, updated: doc.updated, tags: doc.tags }); } } }}} ==== `by_slug` ==== {{{ #!javascript function(doc) { if (doc.type == 'Post') { var year = parseInt(doc.published.substr(0, 4), 10); var month = parseInt(doc.published.substr(5, 2), 10); emit([year, month, doc.slug], doc); } } }}} ==== `by_tag` ==== {{{ #!javascript function(doc) { if (doc.type == 'Post' && doc.tags) { for (var idx in doc.tags) { emit([doc.tags[idx], doc.published], { slug: doc.slug, title: doc.title, author: doc.author, published: doc.published, updated: doc.updated, summary: doc.summary, body: doc.body, tags: doc.tags, extended: doc.extended != '' ? '…' : null }); } } } }}} ==== `by_time` ==== {{{ #!javascript function(doc) { if (doc.type == 'Post') { emit([doc.published], { slug: doc.slug, title: doc.title, author: doc.author, summary: doc.summary, body: doc.body, published: doc.published, updated: doc.updated, extended: doc.extended != '' ? '…' : null, tags: doc.tags, allow_comments: doc.allow_comments, num_comments: doc.num_comments, allow_pings: doc.allow_pings, num_pings: doc.num_pings}); } } }}} ==== `by_update` ==== {{{ #!javascript function(doc) { if (doc.type == 'Post') { emit([doc.updated], null); } } }}} ==== `months` ==== ''Map'': {{{ #!javascript function(doc) { if (doc.type == 'Post') { var year = parseInt(doc.published.substr(0, 4), 10); var month = parseInt(doc.published.substr(5, 2), 10); emit([year, month], 1); } } }}} ''Reduce'': {{{ #!javascript function(keys, values) { return sum(values); } }}} ==== `tags` ==== ''Map'': {{{ #!javascript function(doc) { if (doc.type == 'Post' && doc.tags) { for (var idx in doc.tags) { emit(doc.tags[idx], 1); } } } }}} ''Reduce'': {{{ #!javascript function(keys, values) { return sum(values); } }}} === `_design/comments` === ==== `whitelist` ==== ''Map'': {{{ #!javascript function(doc) { if (doc.type == 'Comment' && doc.published) { emit(doc.openid, 1); } } }}} ''Reduce'': {{{ #!javascript function(keys, values) { return sum(values); } }}} === `_design/pings` === ==== `by_uri` ==== {{{ #!javascript function(doc) { if (doc.type == 'Ping') { emit([doc.post_id, doc.uri], null); } } }}} === `_design/reactions` === ==== `by_post` ==== {{{ #!javascript function(doc) { if (doc.type == 'Ping' && doc.published) { emit([doc.post_id, doc.time], { type: doc.type, uri: doc.uri, title: doc.title, author: doc.author, excerpt: doc.excerpt, time: doc.time }); } else if (doc.type == 'Comment' && doc.published) { emit([doc.post_id, doc.time], { type: doc.type, openid: doc.openid, author: doc.author, markup: doc.markup, time: doc.time }); } } }}} ==== `by_time` ==== {{{ #!javascript function(doc) { if (doc.type == 'Ping' && !doc.published) { emit([doc.time, doc.type], doc); } else if (doc.type == 'Comment' && doc.authenticated && !doc.published) { emit([doc.time, doc.type], doc); } } }}}