-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Keystatic content editing for
docs/
(#9198)
Co-authored-by: Daniel Cousens <413395+dcousens@users.noreply.github.com>
- Loading branch information
1 parent
c58693f
commit 48a56e3
Showing
85 changed files
with
8,846 additions
and
6,244 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { makeRouteHandler } from '@keystatic/next/route-handler' | ||
import config from '../../../../keystatic.config' | ||
|
||
export const { POST, GET } = makeRouteHandler({ | ||
config, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function Page () { | ||
return null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
'use client' | ||
|
||
import { makePage } from '@keystatic/next/ui/app' | ||
import config from '../../keystatic.config' | ||
|
||
export default makePage(config) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import KeystaticApp from './keystatic' | ||
|
||
export default function Layout () { | ||
return ( | ||
<html> | ||
<head></head> | ||
<body> | ||
<KeystaticApp /> | ||
</body> | ||
</html> | ||
) | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
// keystatic.config.ts | ||
import { config, fields, collection } from '@keystatic/core' | ||
import { superscriptIcon } from '@keystar/ui/icon/icons/superscriptIcon' | ||
|
||
import { inline, mark, wrapper } from '@keystatic/core/content-components' | ||
// import { WellPreview } from './keystatic/admin-previews' | ||
|
||
export default config({ | ||
storage: { | ||
kind: 'local', | ||
}, | ||
ui: { | ||
brand: { | ||
name: 'Keystone Website', | ||
}, | ||
}, | ||
collections: { | ||
docs: collection({ | ||
label: 'Docs', | ||
path: 'content/docs/**', | ||
slugField: 'title', | ||
columns: ['title'], | ||
format: { contentField: 'content' }, | ||
schema: { | ||
title: fields.slug({ name: { label: 'Title' } }), | ||
description: fields.text({ label: 'Description' }), | ||
content: fields.markdoc({ | ||
label: 'Content', | ||
extension: 'md', | ||
options: { | ||
heading: { | ||
levels: [1, 2, 3, 4], | ||
schema: { | ||
id: fields.text({ label: 'ID' }), | ||
}, | ||
}, | ||
}, | ||
components: { | ||
heading: wrapper({ label: 'Heading', schema: { id: fields.text({ label: 'ID' }) } }), | ||
well: wrapper({ | ||
label: 'Well', | ||
schema: { | ||
heading: fields.text({ label: 'Heading' }), | ||
grad: fields.select({ | ||
label: 'Gradient', | ||
options: [ | ||
{ label: '1', value: 'grad1' }, | ||
{ label: '2', value: 'grad2' }, | ||
{ label: '3', value: 'grad3' }, | ||
{ label: '4', value: 'grad4' }, | ||
], | ||
defaultValue: 'grad1', | ||
}), | ||
badge: fields.text({ label: 'Badge' }), | ||
href: fields.text({ label: 'Link href', validation: { isRequired: true } }), | ||
target: fields.select({ | ||
label: 'Link target', | ||
description: 'Where should this link open?', | ||
options: [ | ||
{ label: 'New tab', value: '_blank' }, | ||
{ label: 'Same tab', value: '' }, | ||
], | ||
defaultValue: '', | ||
}), | ||
}, | ||
/* | ||
Preview below doesn't work properly, | ||
but you can try enable it :) | ||
*/ | ||
|
||
// ContentView: (data) => <WellPreview {...data} />, | ||
}), | ||
hint: wrapper({ | ||
label: 'Hint', | ||
schema: { | ||
kind: fields.select({ | ||
label: 'Kind', | ||
options: [ | ||
{ label: 'Tip', value: 'tip' }, | ||
{ label: 'Warning', value: 'warn' }, | ||
{ label: 'Error', value: 'error' }, | ||
], | ||
defaultValue: 'tip', | ||
}), | ||
}, | ||
}), | ||
'related-content': wrapper({ label: 'Related Content', schema: {} }), | ||
sup: mark({ label: 'Superscript', schema: {}, icon: superscriptIcon, tag: 'sup' }), | ||
emoji: inline({ | ||
label: 'Emoji', | ||
schema: { | ||
symbol: fields.text({ label: 'Symbol' }), | ||
alt: fields.text({ label: 'Alt' }), | ||
}, | ||
}), | ||
}, | ||
}), | ||
}, | ||
}), | ||
|
||
// Blog | ||
posts: collection({ | ||
path: 'content/blog/*', | ||
label: 'Blog', | ||
slugField: 'title', | ||
columns: ['title'], | ||
format: { contentField: 'content' }, | ||
schema: { | ||
title: fields.slug({ name: { label: 'Title' } }), | ||
description: fields.text({ label: 'Description' }), | ||
publishDate: fields.date({ label: 'Publish Date', validation: { isRequired: true } }), | ||
authorName: fields.text({ label: 'Author Name', validation: { isRequired: true } }), | ||
authorHandle: fields.url({ label: 'Author Handle' }), | ||
metaImageUrl: fields.url({ label: 'Meta Image URL' }), | ||
content: fields.markdoc({ label: 'Content', extension: 'md' }), | ||
}, | ||
}), | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
'use client' | ||
|
||
import { Well } from '../components/primitives/Well' | ||
|
||
export function WellPreview (data) { | ||
return <Well {...data.value}>{data.children}</Well> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { createReader } from '@keystatic/core/reader' | ||
import keystaticConfig from '../keystatic.config' | ||
|
||
export const reader = createReader(process.cwd(), keystaticConfig) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
/// <reference types="next" /> | ||
/// <reference types="next/image-types/global" /> | ||
/// <reference types="next/navigation-types/compat/navigation" /> | ||
|
||
// NOTE: This file should not be edited | ||
// see https://nextjs.org/docs/basic-features/typescript for more information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.