Backport #11348 to fix `link_to` with url hashes and block