This kind of feature would likely have to be implemented at the template level, yes, since at any other point before that (parser, renderer) activity context ends with the current page. At a first glance it would even be possible to do this for most templates, even if they already include a sidebar in the layout, provided some AJAX and proper marking (via #id
) of the n-2, n-1, n th page visited containers.