Custom static site generator

I have a custom static site generator written in Golang and I would like to use it for building the websites.

This static generator is a compiled binary, and I wonder how I can use it like you can Hugo with Netlify.

Is this even possible at this moment?

My guess would be that you can publish it as a Node Module, and use that as a dependency in your package.json. You can run your build command when npm run build is executed.

Hey @mitjafelicijan :wave:t2:

Welcome to The Community :slight_smile:

Yes, totally possible. The build container / image that Netlify runs your build command in after it’s cloned your code already has Go built in; so instead of pre-compiling the binary to your repository, you could actually just make your build command go build && ./output or etc.

If you do prefer to strictly use a binary / pre-compiled version of your SSG, just make sure the compile target is compatible with Ubuntu 16.04 (Xenial build image) and then you could directly run it in your build command

Hope that helps! :+1:t2:


Jon

Thanks, @jonsully

One additional question. In case of precompiled version I would then need to also push binary SSG with the code right?

Yes; although you’ll really want to make sure you’re building for the correct underlying architecture! Sniffing out a slightly-off architecture error sounds… painful :slight_smile:


Jon

1 Like