Fix ToC generator to work with base

Subpages use the `base` tag, the ToC generator doesn't take this in to account and generates document fragment links based on the homepage, essentially rendering the ToC useless on any page not in prism root.