close Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Version 10 (modified by cmlenz, 16 years ago) (diff)

Document config options

Divan

Divan is a simple blogging platform that is included with Diva as an example application.

It uses CouchDB (via the CouchDB-Python library) for storage.

It supports comments with OpenID authentication, pingbacks, Atom feeds for the whole blog, individual categories, and comments, and the 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 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

CouchDB Views

All views are in Javascript.

_design/posts

by_month

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

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

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

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

function(doc) {
  if (doc.type == 'Post') {
    emit([doc.updated], null);
  }
}

months

Map:

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:

function(keys, values) {
  return sum(values);
}

tags

Map:

function(doc) {
  if (doc.type == 'Post' && doc.tags) {
    for (var idx in doc.tags) {
      emit(doc.tags[idx], 1);
    }
  }
}

Reduce:

function(keys, values) {
  return sum(values);
}

_design/comments

whitelist

Map:

function(doc) {
  if (doc.type == 'Comment' && doc.published) {
    emit(doc.openid, 1);
  }
}

Reduce:

function(keys, values) {
  return sum(values);
}

_design/pings

by_uri

function(doc) {
  if (doc.type == 'Ping') {
    emit([doc.post_id, doc.uri], null);
  }
}

_design/reactions

by_post

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

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);
  }
}