Call a Hugo build from within a golang program?

Greetings,

We are building, in golang, a system to allow users to upload files and publish them as mini websites. We’d like to use Hugo for the publishing part of this.

It is possible to execute a Hugo build from within a golang program? We prefer not to invoke a shell command as that introduces new dependencies.

Thanks very much for any thoughts on this.

I do believe this is possible with Hugo Pipes if I understand your question correctly.

1 Like

The source code of Hugo is open, so I guess this is simply a matter of using Hugo as a dependency just like any other Golang dependency.

1 Like

As @klakegg says, it is possible. I would however recommend you use the CLI API (see main.go).

1 Like

Thank you! Our golang developer will try out using the CLI API and we’ll report back.