       current.title = title ? current.title # overwrite defaults with non-nulls
       current.order = order ? current.order
       # use leaf to make the nav object
-      nav = navInContext current, [path.join '']
+      nav = navInContext current, [path]
       # set properties of vinyl object XXX does this need error handling?
       for target in targets
         obj = file

through = require 'through2'
{relative, resolve} = require './web-path'

root = rootName = null

module.exports = ({sources, targets, titles, orders, skips, hrefExtension,

      path = resolve '/', file.relative
        .replace /index\.[^/]+$/, ''          # index identified with directory
        .replace /\.[^./]+$/, '.' + hrefExtension     # e.g. '.jade' -> '.html'
      # find the right spot for the new resource
      current = navTree
      for element in (path.split /([^/]*\/)/  # e.g. '/a/b' -> ['/', 'a/', 'b']
          .filter (element) -> element isnt '')
        current = current.children[element] ?= # recurse down the path, filling
          parent: current                      # in tree with missing elements
          children: {}
