set the "closest path" (if any) to be accessible from templates

For https://github.com/codeparty/derby/issues/420

Would something like this be feasible? It seems to solve my problem.