Global Cache Working too well?
This is exactly what caching is supposed to do... flatten the Twig code down to basic HTML, and serve that up instead of dynamically rendering it. Using globally means that the HTML would be identical on every page, which is not really what you want here.

Get rid of globally, so it can cache separately for each page. Since the URL is supposed to affect how that snippet is rendered, you don't want to cache globally.