How to relative urls & baseURL

Currently Hugo is generating:
<a href="http://localhost:1313/">guitarist singer</a>

But I think it should be generating:
<a href="https://phildoughty.com/">guitarist singer</a>
in the file Hugo.toml, I changed baseURL from:
baseURL = ’ ’
to:
baseURL = ‘https://phildoughty.com/

Also why are absolute urls are being generated. I understand some js/css files are sometimes sourced from content delivery networks etc What are some possible reasons for this? And how can I set all links to be relative and not absolute?

Thanks in advance

Are you getting http://localhost in dev environment or production environment ? dev will generate localhost type URL which production etc. will use baseURL.
Also, hugo serve command used dev environment.

Thanks for the reply! I didn’t know this was a thing.

How do I switch between environment & production environments ?

1 Like

And how can I set all links to be relative and not absolute?

This depends on your templates, theme(s), site configuration, and maybe even your front matter.

You are more likely to receive a prompt and accurate response if you 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.