Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/src/content/navigation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ navGroups:
discriminant: page
value: cloud
isNew: true
- label: Using in a monorepo
link:
discriminant: page
value: using-in-a-monorepo
isNew: true
- label: GitHub mode
link:
discriminant: page
Expand Down
41 changes: 41 additions & 0 deletions docs/src/content/pages/using-in-a-monorepo.mdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
title: Using in a monorepo
---
To use Keystatic in a monorepo there are just a few things you need to be aware of.

## Schema path

The `path` in your schema should be relative to the root of your app rather than the root of the repo. Your post collection should look like this:

```diff
const posts = collection({
label: 'Posts',
slugField: 'title',
- path: 'apps/docs/content/posts/*',
+ path: 'content/posts/*',
format: { data: 'json' },
schema: {
title: fields.slug({ name: { label: 'Title' } }),
content: fields.document({
label: 'Content',
}),
},
});
```

## Storage mode

When using Keystatic in [GitHub](/docs/github-mode) or [Cloud](/docs/cloud) mode, you will need to specify the path prefix:

```javascript
const storage: Config["storage"] =
process.env.NODE_ENV === "production"
? {
kind: "github",
pathPrefix: "apps/docs",
repo: "thinkmill/keystatic",
}
: {
kind: "local",
};
```