       if not exists
         # Find static file that matches URL
         staticPath = "#{basedir}/#{year}/#{month}/#{slug}"
-        fs.exists staticPath, (exists) ->
-          if exists
+        fs.stat staticPath, (err, stats) ->
+          if err
+            respondWithNotFound res
+          else if stats.isDirectory()
+            next()  # Will match the next route
+          else
             res.sendfile staticPath
-          else
-            respondWithNotFound res
         return
       fs.readFile filepath, {encoding:'utf8'}, (err, markdown) ->
         if err

    logMessage "done (#{elapsedTime} ms)", noTime:true

  # Single entry (e.g. /2013/05/26/how_i_learned_javascript)
  app.get /^\/(\d{4})\/(\d{2})\/(\d+)(-\d+)?\/(.*)$/, (req, res) ->
    year  = req.params[0]
    month = req.params[1]
    date  = req.params[2]

          res.setHeader 'Content-Type', 'text/html; charset=utf-8'
          res.send html

  # Redirect /2013/05/27/ to /2013/05/ (after matching against the previous route)
  app.get /^\/(\d{4})\/(\d{2})\/[\d-]+\/?/, (req, res) ->
    year  = req.params[0]
    month = req.params[1]
    res.redirect "/#{year}/#{month}/"

  # List of years
  app.get '/archives', (req, res) ->
    years = listYears()
