Visual Editor for Hugo

Hi,
I’m trying to use visual editor with my Hugo blog. I added the following to my stackbit.config.ts file, but I think there should also be a devCommand since the ssgName is custom. Can anyone help me with that?

import { defineStackbitConfig } from '@stackbit/types';

export default defineStackbitConfig({
    "stackbitVersion": "~0.6.0",
    "nodeVersion": "18",
    "ssgName": "custom",
    "contentSources": [],
    "postInstallCommand": "npm i --no-save @stackbit/types"
})

Currently, when I run visual editor I get the following error:

2:24:20 AM: Running dev server
2:24:20 AM: ──────────────────────────
2:24:20 AM: [info] Current working directory: .
2:24:20 AM: [info] Running dev server using: 'undefined '...
2:24:20 AM: [info] to configure a different command use `devCommand`
2:24:20 AM: [error] ❌ Service stopping

Hugo is not available as a binary in the Visual Editor. So you’d have to:

  • either look for a NPM package that would download Hugo for you
  • OR add the Hugo binary to your project

and then you can configure the devCommand to be hugo server.

Thanks for the answer, you mean sth like this:

hugo-bin

Where should I add this package?


P.S.

I tried this:

import { defineStackbitConfig } from '@stackbit/types';

export default defineStackbitConfig({
    stackbitVersion: "~0.6.0",
    nodeVersion: "18",
    ssgName: "custom",
    contentSources: [],
    postInstallCommand: "npm install --no-save @stackbit/types hugo-bin",
    devCommand: "node_modules/.bin/hugo server"
}); 

and got this error:

6:49:27 PM: [debug] [custom]: Error: command error: failed to load modules: failed to download modules: binary with name "go" not found in PATH
6:49:37 PM: [error] ❌ Service stopping

Seems like you’re using Hugo Modules which requires Go installed on the system. Visual Editor does not have Go.

1 Like