Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
[needs porting from 0.0.7. see README] A simple blog couchapp based on the Kanso tutorial
JavaScript
tree: 013b8ed65b

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
deps
lib
static
templates
.gitignore
.gitmodules
README.markdown
kanso.json

README.markdown

This blog is a couchapp based on the Kanso tutorial, with several differences:

  • No comments (not sure whether I'll implement them and how).
  • WYSIWYG editor (jwysiwyg).
  • Although this is not needed in this case (since all documents are written by the blog's admin), html stored in a post's text field is not trusted (maybe the editor was bypassed - e.g. via curl). This is why the text goes through Sanitize.js.
  • Session UI (login/logout/etc.), flash messages, etc. shamelessly copy/pasted from Kanso's admin code.

Note that Sanitize.js is a client-side thing: If you view this post with javascript disabled in your browser, you'll see quoted html instead of the real deal. I'd rather have this server-side (e.g. as part of the code of a view), but couldn't find such a sanitizer [yet?].

Installing

  • Install Kanso on your computer.
  • Clone this repository, cd to its folder, do git submoule init and git submodule update.
  • Copy lib/config-example.js to lib/config.js and edit it (e.g. site name).
  • Setup a CouchDB server (version >= 1.1.0), or use a public one.
  • Create a user (for publishing blog posts), (say - blogger), and give it the staff role from lib/config.js (default is bloggers).
  • Create a database (say - myblog), click security, and add the staff role to the admin roles (say - [ "bloggers" ]).
  • Push to the server. For example: kanso push blogger@http://localhost:5984/myblog, and browse to the url it gives you.

Important: If the server is not localhost, user ssl whenever you push or login, even if it means using an ugly url like https://myserver.iriscouch.com/myblog/_design/icanblogz/_rewrite/ instead of http://blog.myserver.iriscouch.com.

Sad note: I can push this app to localhost, but I keep getting Error: EPIPE, Broken pipe when I try it on iriscouch. I simply push to localhost, keep the db clean of docs (only design docs) and replicate to iriscouch each time I change the code. Sad [as promised], but I'll live.

Using kansoblog as a carousel iframe

If you want an iframe in some other site (e.g. as a text widget in wordpress) that shows something like "random tips", you can create a kansoblog instance for this purpose, fill it with some short items, and use the blog's /carousel page as that iframe. Here's a demo.

Note that you can say in lib/config.js how many items you want to fetch for the carousel's query (e.g. latest 23 items). They will be randomize on the browser's side, but we fetch all of them - so a large number may take longer to load.

You should also define carousel's skin there: Kansoblog comes with a skin called mango (a variation on tango that came with jcarousel). Jcarousel skins dictate size, colors, etc., so if you want to change any of these - duplicate static/jcarousel/skins/mango/, customize the files there, and define the new folder's name as your jcarousel style at lib/config.js.

Something went wrong with that request. Please try again.