Astro Blog with Netlify CMS

16 May 2022

Using Netlify CMS with an Astro site

Astro + Netlify CMS logos

Netlify CMS is an open-source, Git-based content management system. It provides a single-page app for editing content and can publish that content by committing it to a hosted Git repo (for example on GitHub or GitLab).

Adding Netlify CMS to an Astro site would usually involve creating a number of files in different parts of your project directory and then keeping all those moving parts in sync. With the astro-netlify-cms integration, you configure the integration in your astro.config.mjs file and the integration takes care of the rest.

import { defineConfig } from 'astro/config';
import NetlifyCMS from 'astro-netlify-cms';

export default defineConfig({
  integrations: [
    NetlifyCMS({
      config: {
        backend: {
          name: 'git-gateway',
          branch: 'main',
        },
        collections: [
          // Content collections
        ],
      },
    }),
  ],
});