Hugo building html page with localhost links instad of correct domain name

I have been able to generate all pages correctly. Today I just went ahead and generated a new bundle page, and it’s not building correctly.

Took a look at the html in the public folder and instead of building links with my domain it’s keeping the localhost URL in everything which is weird.

I didn’t change anything in config.toml or any other configuration. I just created a new page. Furthermore, I also tried a different folder and when doing so the page gets generated properly.

content/deals/festinger-vault/index.md (broken html)
content/festinger-vault/index.md (works)

deals folder already has a index.md on that directory.

Index.md is also using permalink: /deals/festingervault/

What should i look for? Any common mistakes perhaps in folder structure or links?

Both hugo and hugo server publish files to the public directory.

When you run hugo, the baseURL is the value in your site configuration, verbatim.

When you run hugo server, the baseURL is something like http://localhost:1313/ followed by the subdirectory (if any) that’s included in the baseURL as defined in your site configuration.

In either case, Hugo appends a backslash if not present.

Bottom line:

  1. To build your site for production, run hugo
  2. To build your site for local testing, run hugo server
3 Likes