Menu-item URL not encoding properly

Hi there!

I have a menu-item defined in config as such:

[[menu.za]]
name = "Choose another region"
parent = "More"
weight = 13
pre = "<hr class=“navbar-divider”>"
url = “/?rs=1”

I am calling it in a template like so:

{{ .Name }}

The resulting URL produced is “rs1”, sans the question mark and equals sign. I have also tried safeHTML and safeHTMLAttr as the piped function. Neither works.

Any ideas? I am using Hugo 0.27.1.

[[menu.za]]
    name = "Choose another region"
    parent = "More"
    weight = 13
    pre = "<hr class=\"navbar-divider\">"
    url = "/?rs=1"
<a href="{{ .URL | safeURL }}">{{ .Name }}<a>

Put code stuff in backticks. :slight_smile:

I don’t have a moment to check this, but wanted it to be easier for other folks to assist. Also, if your code is online @Servo, link to it. It is easier to clone and run your code than it is to make up a test site with a menu. Pro-tip! :sunglasses:

Thanks, @maiki! Must have been the lateness of the hour, but I completely fluffed the description of the problem. Your solution is exactly what I had, and it still gave me the same error. However, I have moved on to an alternate solution to what I wanted to accomplish, and things work as expected now. If I get a moment I will see if I can reproduce the problem, and post an update here.

Thank you so much for taking a moment to reply! I appreciate it a lot. And thanks for the pro tip!