gohugoio / hugo

The world’s fastest framework for building websites.
https://gohugo.io
Apache License 2.0
74.63k stars 7.45k forks source link

Strange BaseUrl behaviour #1046

Closed bst27 closed 9 years ago

bst27 commented 9 years ago

I think the behaviour regarding the BaseUrl parameter is very confusing.

Like described in issue 170 Hugo has the behavior that if you call it with server, regardless of the baseurl in the config file it will render all links with localhost:1313.

At least for me this behaviour is absolutely not what I expect. I think there should be no difference between the content hugo generates and the content the built-in server serves. Also it is a very daring default setting, because I have the hugo server running inside a virtual ubuntu machine and I am accessing the content with the virtual machines IP address. So obviously this will not work. Is it not meant to be used this way? Why is the hugo server then listening on 0.0.0.0?

bep commented 9 years ago

As this is a file server (mainly) built for live preview I wouldn't call it "daring default setting" ... when that default setting is what 99.99% wants. Very few needs to run a virtual Ubuntu since it runs fine in the main OS.

But a suggestion that would cover both bases is always welcome.

bst27 commented 9 years ago

My suggestion is to always use the baseurl. If there is no baseurl defined the server still could fallback to its current behaviour.

bep commented 9 years ago

You should be able to start it with hugo server --baseUrl=http://foo.com or any address you want and it should work.

bst27 commented 9 years ago

You are right, this solves the problem with the "broken" URLs but not the confusing behaviour. For example I am able to serve with --theme=html5 which overrides the theme defined in my config.toml. Serving with --baseUrl=http://foo.com on the other hand does not override my BaseUrl defined in my config.toml but a BaseUrl defined somewhere internally because my BaseUrl defined is not used. In my opinion this shouldn't work this way.

bep commented 9 years ago

This was a design decision before my time -- and as such hard to revert.

I suggest you take this one further at http://discuss.gohugo.io/

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.