In birdnotes.net I took the view that it should follow the path the user took to get there. This requires some care, i.e. stripping off elements when you skip around in order to maintain the navbar in a hierarchical form. You can't really use the navbar as a history bar reflecting the entire path the user's entered, but you can (for instance) remember whether or not the user got to an "edit" page from the "bar" package or the "foo" package and build the navbar accordingly.
Working just off the site map doesn't work for the other style, either, as you want nav bars like:
... | New Post | Confirm New Post
where the "new post" and "confirm" pages are in the same directory within the site map. So the site map can build the first part of a nav bar that locates you within the URL "directory" structure, but not
the last part that lets you move around files within that "directory".
And it helps even lest if you adopt the "nav bar should reflect the path the user took to get here" paradigm.