The .PathMatches function exposes the Path RequestMatcher to the template context. This matcher compares the request URI against a base path, rather than an exact match, and it’s frequently used to determine if a middleware configuration is applicable to a given request. For this purpose, a path of / will match every request without fail.
You could instead check the exact path by using the built-in eq function and the URL.Path variable: