Leading forward slash in menu entry's URL field

This post recommends URLs not starting from /. I observed that in some cases, say, in my previous question, / got interpreted as the domain name instead of the site’s baseURL. This motives me to ask whether the leftmost / in the url field in docs page about Hugo Menus needs to be removed.

[menu]

  [[menu.main]]
    identifier = "about"
    name = "about hugo"
    pre = "<i class='fa fa-heart'></i>"
    url = "/about/"
    weight = -110

  [[menu.main]]
    name = "getting started"
    post = "<span class='alert'>New!</span>"
    pre = "<i class='fa fa-road'></i>"
    url = "/getting-started/"
    weight = -100

Quote

The URLs must be relative to the context root. If the baseURL is https://example.com/mysite/ , then the URLs in the menu must not include the context root mysite . Using an absolute URL will override the baseURL. If the value used for URL in the above example is https://subdomain.example.com/ , the output will be https://subdomain.example.com .

It depends from baseURL

2 Likes