Using Hugo as a library?

I have to integrate static site generation into a larger product.

Can I reference Hugo as a lib? Is it designed for it?

Doing so, can I add custom shortcode plugins?

Update, it is possible.

Here is the code I got to start rolling.

It is rough, but I have proven it is feasible.

I need to implement dynamic pages based off of a complicated Go struct, so I am going to use the afero.Fs stuff to “fake” files that don’t really exist.

It is not built to be used as a library, but it can be done.

I would recommend to use the CLI:

I need the ability to provide dynamic pages. So, I am trying to hack at the aferofs stuff, before calling build, to provide these pages.

The struct is complicated as well, and don’t want to generate files before hugo gets run.

Would you recommend another approach?

I would do it without Hugo.

Generate the pages before I run Hugo?

What about providing a single json feed to Hugo?

Like this: https://github.com/SchumacherFM/hugo/commit/0f32b3720e7affc5670fd207eafdd6891db783ae