HUGO
Menu
GitHub 90498 stars Mastodon

urls.PathUnescape

Returns the given string, replacing all percent-encoded sequences with the corresponding unescaped characters.
Syntax
urls.PathUnescape INPUT
Returns
string
New in v0.153.0

Usage

The urls.PathUnescape function returns the given string, replacing all percent-encoded sequences with the corresponding unescaped characters. Use this function to decode a segment within a URL path. The function does not replace plus signs (+) with spaces. The build fails if the string contains an invalid percent-encoded sequence.

The urls.PathEscape function performs the inverse transformation.

Examples

{{ urls.PathUnescape "my%20caf%C3%A9" }} → my café
{{ urls.PathUnescape "A%2Fb%2Fc%3Fd=%C3%A9&f=g+h" }} → A/b/c?d=é&f=g+h