-
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.
make blog posts and docs page editable with Keystatic
- Loading branch information
1 parent
c58693f
commit 323255e
Showing
78 changed files
with
13,090 additions
and
13,792 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,112 @@ | ||
// keystatic.config.ts | ||
import { config, fields, collection } from '@keystatic/core' | ||
import { superscriptIcon } from '@keystar/ui/icon/icons/superscriptIcon' | ||
|
||
import { 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' }), | ||
}, | ||
}), | ||
}, | ||
}), | ||
|
||
// 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
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
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,20 +1,24 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "esnext", | ||
"lib": ["dom", "dom.iterable", "esnext"], | ||
"allowJs": true, | ||
"skipLibCheck": true, | ||
"strict": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"strict": false, | ||
"noEmit": true, | ||
"esModuleInterop": true, | ||
"incremental": true, | ||
"module": "esnext", | ||
"moduleResolution": "node", | ||
"esModuleInterop": true, | ||
"moduleResolution": "bundler", | ||
"resolveJsonModule": true, | ||
"isolatedModules": true, | ||
"jsx": "preserve", | ||
"incremental": true | ||
"plugins": [ | ||
{ | ||
"name": "next" | ||
} | ||
], | ||
"strictNullChecks": true | ||
}, | ||
"exclude": ["node_modules"], | ||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"] | ||
"include": ["next-env.d.ts", ".next/types/**/*.ts", "**/*.ts", "**/*.tsx"], | ||
"exclude": ["node_modules"] | ||
} |
Oops, something went wrong.