Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default function ExamplePage(props) {
// grab the instance of the CMS to access the registered git API
const cms = useCMS()
// add a form to the CMS; store form data in `post`
const [post, form] = useLocalForm({
id: props.fileRelativePath,
label: 'Edit Post', // needs to be unique
// starting values for the post object
initialValues: { title: props.title, headline: props.headline, markdown: props.markdown },
// field definition
fields: [
{ name: 'title', label: 'Title', component: 'text' },
{ name: 'headline', label: 'Headline', component: 'textarea' },
{
name: 'markdown',
component: 'markdown',
label: 'Post Body',
description: 'Edit the body of the post here',
},
], // save & commit the file when the "save" button is pressed
onSubmit(data) {