URL rendering

Would anyone know why the difference in rendering these URLs

[[main]]
name = "Calculators"
url = "calcs/"

Renders as http://localhost:1313/calcs/

[[main]]
name = "Calculators"
url = "calculators/"

Renders as http://localhost:1313/calculators
and lacks the “/” at the end

In fact any other word including “calculator” “calculater” renders correctly with a “/” at the end

Is the word “calculators” a reserved word?

First, I am unable to reproduce the problem with v0.123.8. I didn’t test anything earlier than that.

Second, you should use the pageRef menu property for internal links.

/home/user/project/hugo.toml

[[menus.main]]
name = 'Calcs'
pageRef = '/calcs'
weight = 10

[[menus.main]]
name = 'Calculators'
pageRef = '/calculators'
weight = 20

A simple menu template that ranges through site.Menus.main yields:

<nav class="menu">
  <a href="/calcs/">Calcs</a>
  <a href="/calculators/">Calculators</a>
</nav>

If you need additional assistance, please post a link to your project’s Git repository.

See Requesting Help.

Let us see your code

Include a link to the source code repository of your project, because we really need the context of seeing your templates and partials to be able to help you. It is trivial to do a quick git clone on your repo, then run hugo server in your project, to help you out. On the other hand, recreating your code from screenshots, or sort of guessing at it, is not.

If you can’t share your repository for whatever reason, consider creating a dummy repo that you can share, which reproduces the problem you’re experiencing.

Thank you for your help. I went ahead and changed the menus to pageRef.
There is a new error

ERROR Rebuild failed: render: failed to render pages: open “…/public/calculators/index.html: not a directory”

I purged all the files under public, i ran the npm run build command

This is impossible to troubleshoot without access to your project. Please see my previous response.

the curious thing is if the directory and menu pageref are named “calculator” it works, but “calculators” doesn’t.

How can i provide access to the project? its just a clone of the “hugoplate” template

Create a Git repository.

Thank you. I rebuilt the project. It seems the problem was file naming.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.