"Web Server is available at //localhost:1313/" is printed for no baseurl config

There’s no URL scheme. Is this a bug? If not, it seems like it should be, because I can’t double click it to browse to it, and http://localhost:1313/ does work.

1 Like
baseURL = '/'

This is a valid baseURL in one case only: when building a site that can be navigated via the file system (i.e., no web server). In all other cases the baseURL should include protocol and trailing slash.

Even if the terminal message isn’t what you want or think it should be, I would be irritated if we changed the behavior. I clone and test projects on a weekly (sometimes daily) basis.

And one of the first clues that a site might be misconfigured is when I see:

web Server is available at //localhost:1313/

I’m not sure I see the tangible debug benefit of knowing that they haven’t set baseurl, since it might be a template or other unrelated issue, so maybe it depends on context. It’s not misconfigured if --baseURL is given, which they might be assuming in production, as the “Deploy Hugo to Pages” workflow on GitHub does, so arguably //localhost:1313/ isn’t even a sure sign of misconfiguration.

It seems to me that the output should reflect what Hugo is actually doing: serving at http://localhost:1313.

(By the way, I’ve found that a trailing slash isn’t required.)

Edit: Note that in this scenario, baseurl = ... is absent from the config. There’s no line setting baseurl at all. So baseurl is not set to /.

Unfortunately, site.BaseURL is exposed to the templates, and has been abused/misused by both site and theme authors. Just because it works for you is not an indication that it works for everybody else. I’ve spent way too much time troubleshooting this issue, repeatedly.

<link rel="stylesheet" href="{{ site.BaseURL }}css/style.css">

Unwise? Yes. Unheard of, no. Fixed by always including a trailing slash? Yes.


I see what you mean. Makes sense.

Since the current behavior is printing incorrect info, I filed a bug for this: “Web Server is available at //localhost:1313/” is printed for no baseurl config · Issue #10765 · gohugoio/hugo · GitHub