Make resolve-url more robust
Break link creation logic into module, test it