urls.PathEscape
Returns the given string, applying percent-encoding to special characters and reserved delimiters so it can be safely used as a segment within a URL path.
- Syntax
- urls.PathEscape INPUT
- Returns
- string
Usage
The urls.PathEscape function returns the given string, applying percent-encoding to special characters and reserved delimiters so that you can use it as a segment within a URL path. The function encodes slashes (/) and question marks (?), so do not pass a complete path to this function. Encode each segment of the path instead.
The urls.PathUnescape function performs the inverse transformation.
Examples
{{ urls.PathEscape "my café" }} → my%20caf%C3%A9
{{ urls.PathEscape "a/b?c" }} → a%2Fb%3FcLast updated:
November 15, 2026
:
content: Apply style guide to urls functions (7d84f1890)
Improve this page