Static Site Generation with Decoupled Drupal and Hugo via JSON API

I am currently working on the integration of Decoupled Drupal CMS and Hugo SSG via JSON API.

My GitLab repository is at:

I don’t think it fully supports the usage of advanced Drupal users, but it may be good enough as a starter.

Any comments or suggestions are welcome.

1 Like

Its demo site is at (with Umami starter kit).

I like your JS solution for querying the JSON API and writing the response to files for Hugo to process. This is something I wish Hugo supported natively (afaik Hugo can only query JSON inside a template, not generate files from the results).

Thanks! I first tried Gatsby.js which can directly access Drupal without downloading, but finally reached this simple approach.

The downloading step is unnecessary for generation itself, but I think there are some merits to it.

  • Local editing: You can edit Hugo files locally with your favorite editor (e.g. VS code), and feed it back to Drupal via Feeds module of Drupal.
  • Incremental generation: It will be possible to download only newly modified files from Drupal and do regeneration with Hugo.

Both of them are just ideas now, and I have no implementation.