     #    ----------------------------
     #    
     app.get "/blog/tag/:name", (req, res) ->
-      check = 0
-      categories = undefined
-      tags = undefined
-      entries = undefined
-      eventflow = new eventEmitter()
-      blog.getCategories (err, cat) ->
-        categories = cat
-        check++
-        eventflow.emit "render"  if check is 3
+      res.render "blog",
 
-      blog.getEntry
-        "tags.name": req.params.name
-      , (err, ent) ->
-        entries = ent
-        check++
-        eventflow.emit "render"  if check is 3
-
-      blog.getTags (err, tag) ->
-        tags = tag
-        check++
-        eventflow.emit "render"  if check is 3
-
-      eventflow.on "render", ->
-        res.render "blog",
-          entries: entries
-          categories: categories
-          tags: tags
-          config: config
-          request: req
     
     #
     #     `Get posts by category`
     #    ----------------------------
     #    
     app.get "/blog/category/:name", (req, res) ->
-      check = 0
-      categories = undefined
-      tags = undefined
-      entries = undefined
-      eventflow = new eventEmitter()
-      blog.getCategories (err, cat) ->
-        categories = cat
-        check++
-        eventflow.emit "render"  if check is 3
+      res.render "blog",
 
-      blog.getEntry
-        category: req.params.name
-      , (err, ent) ->
-        entries = ent
-        check++
-        eventflow.emit "render"  if check is 3
-
-      blog.getTags (err, tag) ->
-        tags = tag
-        check++
-        eventflow.emit "render"  if check is 3
-
-      eventflow.on "render", ->
-        res.render "blog",
-          entries: entries
-          categories: categories
-          tags: tags
-          config: config
-          request: req
 
   site: (app) ->
     

    #    ----------------------------
    #    
    app.get "/blog/post/:uri", (req, res) ->
      check = 0
      categories = undefined
      tags = undefined
      entry = undefined
      eventflow = new eventEmitter()
      blog.getCategories (err, cat) ->
        categories = cat
        check++
        eventflow.emit "render"  if check is 3

      blog.getEntry
        title: req.params.uri
      , (err, ent) ->
        entry = ent
        check++
        eventflow.emit "render"  if check is 3

      blog.getTags (err, tag) ->
        tags = tag
        check++
        eventflow.emit "render"  if check is 3

      eventflow.on "render", ->
        res.render "post",
          entry: entry
          categories: categories
          tags: tags
          config: config
          request: req
    
    #
    #     `Post create blog post`
    #    ----------------------------
    #    
    app.post "/blog/post/create", checkAuth, (req, res) ->
      entry =
        title: req.body.title
        author: req.session.userId

    #     `Update blog post`
    #    ----------------------------
    #    
    app.put "/blog/post/:id", (req, res) ->
      blog.editEntry req.params.id, req.body, (err, data) ->
        unless err
          res.json result: "OK"
