Relative Urls Have Extra Set of Directories in Url

Hey everyone. I have an issue with the following code. The code below outputs links for a menu. However, the URLs work perfectly when doing hugo serve. Though, when I hugo -b [some string], just these links have extra directories attached to the URL string.

Here’s the code:

</li>
 {{ $currentPage := . }}
 {{ range .Site.Menus.topic }}
 <li class="nav-item reg">
     <a class="nav-link" href="{{ .URL | relURL }}">{{ .Name }}</a>
 </li>
{{ end }}

The link URL outputs like this /some _folder/some_folder/folder/index.html

Where it says some_folder twice, that shouldn’t be there. I have relativeURLs set to true in the config file and also have a baseURL set. When I do hugo -b I also set the baseURL from that.

Any thoughts on how to fix this? I’ve tested using the build in /public and also pushing those static files to GitHub pages, and still get this issue.

What is .URL without baseURL set, with baseURL set, and what value are you using for the baseURL?

Since you mentioned GitHub Pages, I assume this is an open-source project? If so, a link to the repository could be helpful…