Put the identical relative-ify link code into a helper function