add generateUrl with backport for stable5