Netlify visual editor for hugo

stackbit.config.ts

🤏
// stackbit.config.ts
import { defineStackbitConfig } from "@stackbit/types";
import { GitContentSource } from "@stackbit/cms-git";

export default defineStackbitConfig({
  stackbitVersion: "~0.6.0",
  nodeVersion: "20",
  ssgName: 'custom',
  devCommand: "./node_modules/.bin/hugo server -p {PORT}",
  contentSources: [
    new GitContentSource({
      contentDirs: ["content"],
      rootPath: __dirname,
      models: [
        {
          name: "Post",
          label: "Post",
          type: "page",
          urlPath: "/{id}",
          filePath: "content/{id}.md",
          fields: [
            { name: "title", type: "string", required: true },
            { name: 'date', type: 'date', default: 'YYYY-MM-DD'},
            { name: 'slug', type: 'slug', required: false, hidden: true }
          ]
      },
      ],
      assetsConfig: {
        referenceType: "static",
        staticDir: "assets",
        uploadDir: "images",
        publicPath: "/"
      }
    })
  ]
});

package.json

🤏
{
  "devDependencies": {
    "@stackbit/cms-git": "latest",
    "@stackbit/types": "latest",
    "hugo-bin": "latest"
  }
}