/headless-cms

Hugo Module for headless Decap and Sveltia CMS

Primary LanguageHTMLGNU Affero General Public License v3.0AGPL-3.0

Headless CMS Hugo Module

  • Hugo Requirements

A Hugo Module for installing the following popular Headless CMS engines:

Installation

Assuming your Hugo site is already using Hugo Modules, then import the module and append the HeadlessCMSConfig to the home output in your hugo.yaml or config/_default/config.yaml file.

module:
  imports:
  - path: github.com/privatemaker/headless-cms

outputs:
  home:
  - HTML
  - RSS
  - HeadlessCMSConfig

Next create file content/admin/_index.md with following content:

---
title: Your Headless CMS
layout: headless-cms
---

You can access it on /admin for example, http://localhost:1313/admin/

Configuration

Lastly, in the params: section of your site's hugo.yaml or config/_default/params.yaml file, insert and edit in your CMS config values.

params:
  headless_cms:
    engine: "sveltia"
    site_url: "https://your-site.org"
    ...
    backend:
      name: "github"
      repo: "org/repo"
    collections:
      blog:
        create: true
        fields:
          - label: "Title"
            name: "title"
            widget: "string"
        ...

The default value of engine: "sveltia" to draw attention to the great project, but if you need more stability and full functionality use decap engine. The full list of config variables for both Decap and Sveltia CMS (the later uses the same specification) is here:

I am happy to receive pull-requests for other Headless CMS engines.

Credits

Based on module code of decap-cms by Hugomods.