# Two-Way Markdown & Git Sync

Reference

- [Getting Started](https://spacepress.dev/docs/getting-started/)
  - [Installation & Setup](https://spacepress.dev/docs/getting-started/installation/)
  - [Project Structure](https://spacepress.dev/docs/getting-started/project-structure/)
- [Core Framework](https://spacepress.dev/docs/core/)
  - [Schema & Storage](https://spacepress.dev/docs/core/schema-and-storage/)
  - [Queries & Access Control](https://spacepress.dev/docs/core/queries-and-access/)
  - [Actions, Jobs, Hooks & HTTP Routes](https://spacepress.dev/docs/core/actions-jobs-routes/)
  - [Pages, Layouts & Interactive Islands](https://spacepress.dev/docs/core/pages-and-islands/)
- [Integrations & Ecosystem](https://spacepress.dev/docs/integrations/)
  - [Two-Way Markdown & Git Sync](https://spacepress.dev/docs/integrations/markdown-sync/)
  - [WooCommerce Native Storefront](https://spacepress.dev/docs/integrations/woocommerce/)
  - [React Email Templates](https://spacepress.dev/docs/integrations/react-email/)
  - [Astro & Generated Typed Clients](https://spacepress.dev/docs/integrations/astro-and-clients/)
- [Operations & Tooling](https://spacepress.dev/docs/operations/)
  - [CLI & Deployment](https://spacepress.dev/docs/operations/cli-and-deploy/)
  - [MCP & AI Agents](https://spacepress.dev/docs/operations/mcp-and-agents/)
  - [Deploy on Spacefast](https://spacepress.dev/docs/operations/deploy-spacefast/)
  - [Deploy on Pressable & WordPress.com (WP Cloud)](https://spacepress.dev/docs/operations/deploy-wp-cloud/)
  - [Deploy on Self-hosted WordPress](https://spacepress.dev/docs/operations/deploy-self-hosted/)
- [Reference](https://spacepress.dev/docs/reference/)
  - [Host Contract](https://spacepress.dev/docs/reference/host-contract/)
  - [Tested Compiler Compatibility](https://spacepress.dev/docs/reference/language-support/)

# Two-Way Markdown & Git Sync

> For AI coding agents: start with [/start.md](/start.md) (build playbook) and [/rules.md](/rules.md) (compiler rules), see [/llms.txt](/llms.txt) for the complete documentation index, or read this page as Markdown at [/md/docs/integrations/markdown-sync.md](/md/docs/integrations/markdown-sync.md).

[View Markdown.md source ↗](/md/docs/integrations/markdown-sync.md)[Open in ChatGPTAsk about this page ↗](https://chatgpt.com/?q=Read%20https%3A%2F%2Fspacepress.dev%2Fmd%2Fdocs%2Fintegrations%2Fmarkdown-sync.md%20%28Two-Way%20Markdown%20%26%20Git%20Sync%29%20and%20help%20me%20with%20questions%20about%20it.)[Open in ClaudeAsk about this page ↗](https://claude.ai/new?q=Read%20https%3A%2F%2Fspacepress.dev%2Fmd%2Fdocs%2Fintegrations%2Fmarkdown-sync.md%20%28Two-Way%20Markdown%20%26%20Git%20Sync%29%20and%20help%20me%20with%20questions%20about%20it.)[start.mdAgent build playbook ↗](/start.md)[rules.mdCompiler rules ↗](/rules.md)[llms.txtFull site index ↗](/llms.txt)

Synchronize Markdown/JSON files in Git with WordPress collections and taxonomies.

## Configuring sync

Add a `sync` glob to any `collection()`, `wp.posts.extend()`, `taxonomy()`, `product()`, or `table()`:

```ts
export const docs = collection({
  title: text(),
  slug: slug({ source: "title" }),
  content: richText().optional(),
}, {
  hierarchical: true,
  url: "/docs/:path",
  sync: "content/docs/**/*.md",
});
```

A `\*\*` folder pattern maps subdirectories into parent/child hierarchy (`index.md` represents the folder item). Every synced record receives an immutable `uid` so renames and slug changes stay linked.

## Running sync & CI workflows

- Run `typedpress sync` to perform a 3-way merge between local Markdown files and WordPress. Front matter is validated against your TypeScript schema before writing.
- Run `typedpress init --github` to scaffold GitHub Actions for automated content sync.
- Configure `typedpress git-dispatch` so edits saved inside WordPress Admin trigger a repository dispatch event automatically.
- Enable `seed: true` in `defineConfig()` to populate synced records when a fresh deployment activates the plugin without overwriting existing editorial changes.

[← Previous**Integrations & Ecosystem**](https://spacepress.dev/docs/integrations/)[Next →**WooCommerce Native Storefront**](https://spacepress.dev/docs/integrations/woocommerce/)

On this page

- [Configuring sync](#configuring-sync)
- [Running sync & CI workflows](#running-sync--ci-workflows)
