My use case is to build a static site locally and publish it to a web server that will serve up the content itself. I'll probably get the files onto the server with rsync.
Because of this, I have no use for hugo's built-in web server. Unfortunately, there doesn't appear to be a way to generate any of the static content without running this web server. This can be problematic if (for whatever reason) you don't have the ability to bind any network sockets, even when using port numbers above 1024.
This would be manageable, except that the documentation doesn't make any mention of this fact anywhere. I've just spent the last half an hour trying to work out how to do this and have come up with nothing.
On top of that, the documentation makes no mention of how certain features behave when not using the built-in web server, such as aliases.
Is there any reason why a hugo build command doesn't exist? If not, is there any reason why it can't be created? At the very least, the documentation should be updated, as this feels like a rather big oversight.
hugo without any arguments IS hugo build.
Where is that documented? At the very least, nothing shows up that indicates this when you run 'hugo help'.
You are correct, it could be better documented in hugo help.
But hugo is the answer to your question.
It does state that it can be run with either flags or subcommand:
Usage:
hugo [flags]
hugo [command]
See also #852
(Hope to find time to work on the documentation in a week or two.)
Where is the text output by hugo help stored in the codebase? I'd be happy to draft an update for it and submit a PR if I could find it.
Surely the best course of action would be to create a hugo build command. It would be a lot easier to document this,and would mean it is not an odd exception to all of the other commands.
No, that's not a good solution. hugo is the main command, all the sub commands are helpers.
I'm ok with an alias. It may help with user experience as this comes up pretty often. Agree with @bep that bare hugo is the right way to do things and shouldn't change.
Hugo 0.13 has the same problem of earlier versions that the baseUrl is always inserted into URLs, meaning that is isn't yet possible to generate a site of purely-static content. I hope this can be resolved soon.
It is related to issue #157, and obliquely to #681.
The main problem is Hugo being able to emit URLs that are purely relative, i.e. without "file:///" or other such problematic prefix. Relative URLs need to be of the form "hello/world.html" or "theme/style.css", i.e. with _no_ leading scheme, domain or slash character.
As of v0.13, there is always some prefix inserted, preventing fully relative URLs. This is problematic.
I've just spent a few minutes reading hugo -h (and all subcommands), eventually I googled and ended up here. A hugo build alias would be useful.
It seems that generated site doesn't have section, so it behavior incorrect, Only works with hugo server to host, say I try using hugo for github pages, it failed ( can't find sectoin url ).
Am I the only one encounter this issue?
version: Hugo Static Site Generator v0.69.2-EC9DCF30 linux/amd64 BuildDate: 2020-04-24T07:48:20Z
For example, for the following about section, It works with hugo server, but not working with a static http fileserver.
[[menu.main]]
name = "about"
pre = "<i class='fa fa-heart'></i>"
weight = -110
identifier = "about"
url = "/about/"
Most helpful comment
I've just spent a few minutes reading
hugo -h(and all subcommands), eventually I googled and ended up here. Ahugo buildalias would be useful.