added a more robust way to generate the full links for URLs by finding the site root address using a regex