[{"data":1,"prerenderedAt":2030},["ShallowReactive",2],{"navigation_docs":3,"-docs-core-working-with-content-writing":478,"-docs-core-working-with-content-writing-surround":2025},[4,352,446],{"title":5,"icon":6,"path":7,"stem":8,"children":9,"page":6},"Docs",false,"\u002Fdocs\u002Fcore","docs\u002F1.core",[10,35,141,174,195,212,242,318],{"title":11,"icon":6,"path":12,"stem":13,"children":14,"page":6},"Getting Started","\u002Fdocs\u002Fcore\u002Fgetting-started","docs\u002F1.core\u002F1.getting-started",[15,19,23,27,31],{"title":16,"path":17,"stem":18},"Introduction","\u002Fdocs\u002Fcore\u002Fgetting-started\u002Fintroduction","docs\u002F1.core\u002F1.getting-started\u002F1.introduction",{"title":20,"path":21,"stem":22},"Quick Start","\u002Fdocs\u002Fcore\u002Fgetting-started\u002Fquick-start","docs\u002F1.core\u002F1.getting-started\u002F2.quick-start",{"title":24,"path":25,"stem":26},"Add to an Existing Site","\u002Fdocs\u002Fcore\u002Fgetting-started\u002Fexisting-site","docs\u002F1.core\u002F1.getting-started\u002F3.existing-site",{"title":28,"path":29,"stem":30},"Configuration","\u002Fdocs\u002Fcore\u002Fgetting-started\u002Fconfiguration","docs\u002F1.core\u002F1.getting-started\u002F4.configuration",{"title":32,"path":33,"stem":34},"How Tenon works","\u002Fdocs\u002Fcore\u002Fgetting-started\u002Fhow-tenon-works","docs\u002F1.core\u002F1.getting-started\u002F5.how-tenon-works",{"title":36,"icon":6,"path":37,"stem":38,"children":39,"page":6},"Content Modeling","\u002Fdocs\u002Fcore\u002Fcontent-modeling","docs\u002F1.core\u002F2.content-modeling",[40,44,111,115,119],{"title":41,"path":42,"stem":43},"Collections and Globals","\u002Fdocs\u002Fcore\u002Fcontent-modeling\u002Fcollections-and-globals","docs\u002F1.core\u002F2.content-modeling\u002F1.collections-and-globals",{"title":45,"icon":6,"path":46,"stem":47,"children":48},"Fields","\u002Fdocs\u002Fcore\u002Fcontent-modeling\u002Ffields","docs\u002F1.core\u002F2.content-modeling\u002F2.fields\u002Findex",[49,51,55,59,63,67,71,75,79,83,87,91,95,99,103,107],{"title":50,"path":46,"stem":47},"Overview",{"title":52,"path":53,"stem":54},"Array","\u002Fdocs\u002Fcore\u002Fcontent-modeling\u002Ffields\u002Farray","docs\u002F1.core\u002F2.content-modeling\u002F2.fields\u002F01.array",{"title":56,"path":57,"stem":58},"Blocks","\u002Fdocs\u002Fcore\u002Fcontent-modeling\u002Ffields\u002Fblocks","docs\u002F1.core\u002F2.content-modeling\u002F2.fields\u002F02.blocks",{"title":60,"path":61,"stem":62},"Boolean","\u002Fdocs\u002Fcore\u002Fcontent-modeling\u002Ffields\u002Fboolean","docs\u002F1.core\u002F2.content-modeling\u002F2.fields\u002F03.boolean",{"title":64,"path":65,"stem":66},"Date","\u002Fdocs\u002Fcore\u002Fcontent-modeling\u002Ffields\u002Fdate","docs\u002F1.core\u002F2.content-modeling\u002F2.fields\u002F04.date",{"title":68,"path":69,"stem":70},"File","\u002Fdocs\u002Fcore\u002Fcontent-modeling\u002Ffields\u002Ffile","docs\u002F1.core\u002F2.content-modeling\u002F2.fields\u002F05.file",{"title":72,"path":73,"stem":74},"Group","\u002Fdocs\u002Fcore\u002Fcontent-modeling\u002Ffields\u002Fgroup","docs\u002F1.core\u002F2.content-modeling\u002F2.fields\u002F06.group",{"title":76,"path":77,"stem":78},"Image","\u002Fdocs\u002Fcore\u002Fcontent-modeling\u002Ffields\u002Fimage","docs\u002F1.core\u002F2.content-modeling\u002F2.fields\u002F07.image",{"title":80,"path":81,"stem":82},"Link","\u002Fdocs\u002Fcore\u002Fcontent-modeling\u002Ffields\u002Flink","docs\u002F1.core\u002F2.content-modeling\u002F2.fields\u002F08.link",{"title":84,"path":85,"stem":86},"Number","\u002Fdocs\u002Fcore\u002Fcontent-modeling\u002Ffields\u002Fnumber","docs\u002F1.core\u002F2.content-modeling\u002F2.fields\u002F09.number",{"title":88,"path":89,"stem":90},"Relation","\u002Fdocs\u002Fcore\u002Fcontent-modeling\u002Ffields\u002Frelation","docs\u002F1.core\u002F2.content-modeling\u002F2.fields\u002F10.relation",{"title":92,"path":93,"stem":94},"Rich text","\u002Fdocs\u002Fcore\u002Fcontent-modeling\u002Ffields\u002Frich-text","docs\u002F1.core\u002F2.content-modeling\u002F2.fields\u002F11.rich-text",{"title":96,"path":97,"stem":98},"Select","\u002Fdocs\u002Fcore\u002Fcontent-modeling\u002Ffields\u002Fselect","docs\u002F1.core\u002F2.content-modeling\u002F2.fields\u002F12.select",{"title":100,"path":101,"stem":102},"Size","\u002Fdocs\u002Fcore\u002Fcontent-modeling\u002Ffields\u002Fsize","docs\u002F1.core\u002F2.content-modeling\u002F2.fields\u002F13.size",{"title":104,"path":105,"stem":106},"Slug","\u002Fdocs\u002Fcore\u002Fcontent-modeling\u002Ffields\u002Fslug","docs\u002F1.core\u002F2.content-modeling\u002F2.fields\u002F14.slug",{"title":108,"path":109,"stem":110},"Text","\u002Fdocs\u002Fcore\u002Fcontent-modeling\u002Ffields\u002Ftext","docs\u002F1.core\u002F2.content-modeling\u002F2.fields\u002F15.text",{"title":112,"path":113,"stem":114},"Relations","\u002Fdocs\u002Fcore\u002Fcontent-modeling\u002Frelations","docs\u002F1.core\u002F2.content-modeling\u002F3.relations",{"title":116,"path":117,"stem":118},"Media","\u002Fdocs\u002Fcore\u002Fcontent-modeling\u002Fmedia","docs\u002F1.core\u002F2.content-modeling\u002F4.media",{"title":120,"icon":6,"path":121,"stem":122,"children":123},"Presets","\u002Fdocs\u002Fcore\u002Fcontent-modeling\u002Fpresets","docs\u002F1.core\u002F2.content-modeling\u002F5.presets\u002Findex",[124,125,129,133,137],{"title":50,"path":121,"stem":122},{"title":126,"path":127,"stem":128},"Menu","\u002Fdocs\u002Fcore\u002Fcontent-modeling\u002Fpresets\u002Fmenu","docs\u002F1.core\u002F2.content-modeling\u002F5.presets\u002F1.menu",{"title":130,"path":131,"stem":132},"Pages","\u002Fdocs\u002Fcore\u002Fcontent-modeling\u002Fpresets\u002Fpages","docs\u002F1.core\u002F2.content-modeling\u002F5.presets\u002F2.pages",{"title":134,"path":135,"stem":136},"Settings","\u002Fdocs\u002Fcore\u002Fcontent-modeling\u002Fpresets\u002Fsettings","docs\u002F1.core\u002F2.content-modeling\u002F5.presets\u002F3.settings",{"title":138,"path":139,"stem":140},"Strings","\u002Fdocs\u002Fcore\u002Fcontent-modeling\u002Fpresets\u002Fstrings","docs\u002F1.core\u002F2.content-modeling\u002F5.presets\u002F4.strings",{"title":142,"icon":6,"path":143,"stem":144,"children":145,"page":6},"Working with Content","\u002Fdocs\u002Fcore\u002Fworking-with-content","docs\u002F1.core\u002F3.working-with-content",[146,150,154,158,162,166,170],{"title":147,"path":148,"stem":149},"Reading","\u002Fdocs\u002Fcore\u002Fworking-with-content\u002Freading","docs\u002F1.core\u002F3.working-with-content\u002F1.reading",{"title":151,"path":152,"stem":153},"Writing and Drafts","\u002Fdocs\u002Fcore\u002Fworking-with-content\u002Fwriting","docs\u002F1.core\u002F3.working-with-content\u002F2.writing",{"title":155,"path":156,"stem":157},"Scheduled publishing","\u002Fdocs\u002Fcore\u002Fworking-with-content\u002Fscheduled-publishing","docs\u002F1.core\u002F3.working-with-content\u002F3.scheduled-publishing",{"title":159,"path":160,"stem":161},"HTTP API and Client","\u002Fdocs\u002Fcore\u002Fworking-with-content\u002Fhttp-api-and-client","docs\u002F1.core\u002F3.working-with-content\u002F4.http-api-and-client",{"title":163,"path":164,"stem":165},"Headless","\u002Fdocs\u002Fcore\u002Fworking-with-content\u002Fheadless","docs\u002F1.core\u002F3.working-with-content\u002F5.headless",{"title":167,"path":168,"stem":169},"Localization","\u002Fdocs\u002Fcore\u002Fworking-with-content\u002Flocalization","docs\u002F1.core\u002F3.working-with-content\u002F6.localization",{"title":171,"path":172,"stem":173},"Hooks","\u002Fdocs\u002Fcore\u002Fworking-with-content\u002Fhooks","docs\u002F1.core\u002F3.working-with-content\u002F7.hooks",{"title":175,"icon":6,"path":176,"stem":177,"children":178,"page":6},"Building Your Site","\u002Fdocs\u002Fcore\u002Fbuilding-your-site","docs\u002F1.core\u002F4.building-your-site",[179,183,187,191],{"title":180,"path":181,"stem":182},"Pages and SEO","\u002Fdocs\u002Fcore\u002Fbuilding-your-site\u002Fpages-and-seo","docs\u002F1.core\u002F4.building-your-site\u002F1.pages-and-seo",{"title":184,"path":185,"stem":186},"Components","\u002Fdocs\u002Fcore\u002Fbuilding-your-site\u002Fcomponents","docs\u002F1.core\u002F4.building-your-site\u002F2.components",{"title":188,"path":189,"stem":190},"Menus","\u002Fdocs\u002Fcore\u002Fbuilding-your-site\u002Fmenus","docs\u002F1.core\u002F4.building-your-site\u002F3.menus",{"title":192,"path":193,"stem":194},"Live Preview","\u002Fdocs\u002Fcore\u002Fbuilding-your-site\u002Flive-preview","docs\u002F1.core\u002F4.building-your-site\u002F4.live-preview",{"title":196,"icon":6,"path":197,"stem":198,"children":199,"page":6},"Users and Access","\u002Fdocs\u002Fcore\u002Fusers-and-access","docs\u002F1.core\u002F5.users-and-access",[200,204,208],{"title":201,"path":202,"stem":203},"Authentication","\u002Fdocs\u002Fcore\u002Fusers-and-access\u002Fauthentication","docs\u002F1.core\u002F5.users-and-access\u002F1.authentication",{"title":205,"path":206,"stem":207},"Access Control","\u002Fdocs\u002Fcore\u002Fusers-and-access\u002Faccess-control","docs\u002F1.core\u002F5.users-and-access\u002F2.access-control",{"title":209,"path":210,"stem":211},"API Keys","\u002Fdocs\u002Fcore\u002Fusers-and-access\u002Fapi-keys","docs\u002F1.core\u002F5.users-and-access\u002F3.api-keys",{"title":213,"icon":6,"path":214,"stem":215,"children":216},"Customization","\u002Fdocs\u002Fcore\u002Fcustomization","docs\u002F1.core\u002F6.customization\u002Findex",[217,218,222,226,230,234,238],{"title":50,"path":214,"stem":215},{"title":219,"path":220,"stem":221},"Admin","\u002Fdocs\u002Fcore\u002Fcustomization\u002Fadmin","docs\u002F1.core\u002F6.customization\u002F1.admin",{"title":223,"path":224,"stem":225},"Custom Fields","\u002Fdocs\u002Fcore\u002Fcustomization\u002Fcustom-fields","docs\u002F1.core\u002F6.customization\u002F2.custom-fields",{"title":227,"path":228,"stem":229},"Custom Pages and Actions","\u002Fdocs\u002Fcore\u002Fcustomization\u002Fcustom-pages-and-actions","docs\u002F1.core\u002F6.customization\u002F3.custom-pages-and-actions",{"title":231,"path":232,"stem":233},"Styles and UI Libraries","\u002Fdocs\u002Fcore\u002Fcustomization\u002Fstyles-and-ui-libraries","docs\u002F1.core\u002F6.customization\u002F4.styles-and-ui-libraries",{"title":235,"path":236,"stem":237},"Rich Text Extensions","\u002Fdocs\u002Fcore\u002Fcustomization\u002Frich-text-extensions","docs\u002F1.core\u002F6.customization\u002F5.rich-text-extensions",{"title":239,"path":240,"stem":241},"Plugins","\u002Fdocs\u002Fcore\u002Fcustomization\u002Fplugins","docs\u002F1.core\u002F6.customization\u002F6.plugins",{"title":243,"icon":6,"path":244,"stem":245,"children":246},"Operations","\u002Fdocs\u002Fcore\u002Foperations","docs\u002F1.core\u002F7.operations\u002Findex",[247,248,266,288,306,310,314],{"title":50,"path":244,"stem":245},{"title":249,"icon":6,"path":250,"stem":251,"children":252},"Email","\u002Fdocs\u002Fcore\u002Foperations\u002Femail","docs\u002F1.core\u002F7.operations\u002F1.email\u002Findex",[253,254,258,262],{"title":50,"path":250,"stem":251},{"title":255,"path":256,"stem":257},"SMTP","\u002Fdocs\u002Fcore\u002Foperations\u002Femail\u002Fsmtp","docs\u002F1.core\u002F7.operations\u002F1.email\u002F1.smtp",{"title":259,"path":260,"stem":261},"Cloudflare","\u002Fdocs\u002Fcore\u002Foperations\u002Femail\u002Fcloudflare","docs\u002F1.core\u002F7.operations\u002F1.email\u002F2.cloudflare",{"title":263,"path":264,"stem":265},"Custom adapter","\u002Fdocs\u002Fcore\u002Foperations\u002Femail\u002Fcustom-adapter","docs\u002F1.core\u002F7.operations\u002F1.email\u002F3.custom-adapter",{"title":267,"icon":6,"path":268,"stem":269,"children":270},"Jobs","\u002Fdocs\u002Fcore\u002Foperations\u002Fjobs","docs\u002F1.core\u002F7.operations\u002F2.jobs\u002Findex",[271,272,276,280,284],{"title":50,"path":268,"stem":269},{"title":273,"path":274,"stem":275},"Queue jobs","\u002Fdocs\u002Fcore\u002Foperations\u002Fjobs\u002Fqueue-jobs","docs\u002F1.core\u002F7.operations\u002F2.jobs\u002F1.queue-jobs",{"title":277,"path":278,"stem":279},"Recurring jobs","\u002Fdocs\u002Fcore\u002Foperations\u002Fjobs\u002Frecurring-jobs","docs\u002F1.core\u002F7.operations\u002F2.jobs\u002F2.recurring-jobs",{"title":281,"path":282,"stem":283},"The clock","\u002Fdocs\u002Fcore\u002Foperations\u002Fjobs\u002Fclock","docs\u002F1.core\u002F7.operations\u002F2.jobs\u002F3.clock",{"title":285,"path":286,"stem":287},"Manage jobs","\u002Fdocs\u002Fcore\u002Foperations\u002Fjobs\u002Fmanage-jobs","docs\u002F1.core\u002F7.operations\u002F2.jobs\u002F4.manage-jobs",{"title":289,"icon":6,"path":290,"stem":291,"children":292},"Webhooks","\u002Fdocs\u002Fcore\u002Foperations\u002Fwebhooks","docs\u002F1.core\u002F7.operations\u002F3.webhooks\u002Findex",[293,294,298,302],{"title":50,"path":290,"stem":291},{"title":295,"path":296,"stem":297},"Send webhooks","\u002Fdocs\u002Fcore\u002Foperations\u002Fwebhooks\u002Fsend-webhooks","docs\u002F1.core\u002F7.operations\u002F3.webhooks\u002F1.send-webhooks",{"title":299,"path":300,"stem":301},"Receive webhooks","\u002Fdocs\u002Fcore\u002Foperations\u002Fwebhooks\u002Freceive-webhooks","docs\u002F1.core\u002F7.operations\u002F3.webhooks\u002F2.receive-webhooks",{"title":303,"path":304,"stem":305},"Rebuild on publish","\u002Fdocs\u002Fcore\u002Foperations\u002Fwebhooks\u002Frebuild-on-publish","docs\u002F1.core\u002F7.operations\u002F3.webhooks\u002F3.rebuild-on-publish",{"title":307,"path":308,"stem":309},"Backup and Restore","\u002Fdocs\u002Fcore\u002Foperations\u002Fbackup-and-restore","docs\u002F1.core\u002F7.operations\u002F4.backup-and-restore",{"title":311,"path":312,"stem":313},"Lifecycle Hooks","\u002Fdocs\u002Fcore\u002Foperations\u002Flifecycle-hooks","docs\u002F1.core\u002F7.operations\u002F5.lifecycle-hooks",{"title":315,"path":316,"stem":317},"Upgrades and Schema Changes","\u002Fdocs\u002Fcore\u002Foperations\u002Fupgrades-and-schema-changes","docs\u002F1.core\u002F7.operations\u002F6.upgrades-and-schema-changes",{"title":319,"icon":6,"path":320,"stem":321,"children":322,"page":6},"Reference","\u002Fdocs\u002Fcore\u002Freference","docs\u002F1.core\u002F8.reference",[323,326,344,348],{"title":28,"path":324,"stem":325},"\u002Fdocs\u002Fcore\u002Freference\u002Fconfiguration","docs\u002F1.core\u002F8.reference\u002F1.configuration",{"title":327,"icon":6,"path":328,"stem":329,"children":330},"API","\u002Fdocs\u002Fcore\u002Freference\u002Fapi","docs\u002F1.core\u002F8.reference\u002F2.api\u002Findex",[331,332,336,340],{"title":50,"path":328,"stem":329},{"title":333,"path":334,"stem":335},"Local API","\u002Fdocs\u002Fcore\u002Freference\u002Fapi\u002Flocal-api","docs\u002F1.core\u002F8.reference\u002F2.api\u002F1.local-api",{"title":337,"path":338,"stem":339},"Client","\u002Fdocs\u002Fcore\u002Freference\u002Fapi\u002Fclient","docs\u002F1.core\u002F8.reference\u002F2.api\u002F2.client",{"title":341,"path":342,"stem":343},"HTTP routes","\u002Fdocs\u002Fcore\u002Freference\u002Fapi\u002Fhttp-routes","docs\u002F1.core\u002F8.reference\u002F2.api\u002F3.http-routes",{"title":345,"path":346,"stem":347},"Errors and types","\u002Fdocs\u002Fcore\u002Freference\u002Ferrors-and-types","docs\u002F1.core\u002F8.reference\u002F3.errors-and-types",{"title":349,"path":350,"stem":351},"Package exports","\u002Fdocs\u002Fcore\u002Freference\u002Fpackage-exports","docs\u002F1.core\u002F8.reference\u002F4.package-exports",{"title":353,"icon":6,"path":354,"stem":355,"children":356,"page":6},"Guide","\u002Fdocs\u002Fguide","docs\u002F2.guide",[357,383,400,417],{"title":358,"icon":6,"path":359,"stem":360,"children":361},"Frameworks","\u002Fdocs\u002Fguide\u002Fframeworks","docs\u002F2.guide\u002F1.frameworks\u002Findex",[362,363,367,371,375,379],{"title":50,"path":359,"stem":360},{"title":364,"path":365,"stem":366},"Astro","\u002Fdocs\u002Fguide\u002Fframeworks\u002Fastro","docs\u002F2.guide\u002F1.frameworks\u002F1.astro",{"title":368,"path":369,"stem":370},"Nuxt","\u002Fdocs\u002Fguide\u002Fframeworks\u002Fnuxt","docs\u002F2.guide\u002F1.frameworks\u002F2.nuxt",{"title":372,"path":373,"stem":374},"TanStack Start","\u002Fdocs\u002Fguide\u002Fframeworks\u002Ftanstack-start","docs\u002F2.guide\u002F1.frameworks\u002F3.tanstack-start",{"title":376,"path":377,"stem":378},"Standalone","\u002Fdocs\u002Fguide\u002Fframeworks\u002Fstandalone","docs\u002F2.guide\u002F1.frameworks\u002F4.standalone",{"title":380,"path":381,"stem":382},"Other Frameworks","\u002Fdocs\u002Fguide\u002Fframeworks\u002Fother-frameworks","docs\u002F2.guide\u002F1.frameworks\u002F5.other-frameworks",{"title":384,"icon":6,"path":385,"stem":386,"children":387},"Deployment","\u002Fdocs\u002Fguide\u002Fdeployment","docs\u002F2.guide\u002F2.deployment\u002Findex",[388,389,393,397],{"title":50,"path":385,"stem":386},{"title":390,"path":391,"stem":392},"Node","\u002Fdocs\u002Fguide\u002Fdeployment\u002Fnode","docs\u002F2.guide\u002F2.deployment\u002F1.node",{"title":394,"path":395,"stem":396},"Vercel","\u002Fdocs\u002Fguide\u002Fdeployment\u002Fvercel","docs\u002F2.guide\u002F2.deployment\u002F2.vercel",{"title":259,"path":398,"stem":399},"\u002Fdocs\u002Fguide\u002Fdeployment\u002Fcloudflare","docs\u002F2.guide\u002F2.deployment\u002F3.cloudflare",{"title":401,"icon":6,"path":402,"stem":403,"children":404,"page":6},"Databases and Storage","\u002Fdocs\u002Fguide\u002Fdatabases-and-storage","docs\u002F2.guide\u002F3.databases-and-storage",[405,409,413],{"title":406,"path":407,"stem":408},"Databases","\u002Fdocs\u002Fguide\u002Fdatabases-and-storage\u002Fdatabases","docs\u002F2.guide\u002F3.databases-and-storage\u002F1.databases",{"title":410,"path":411,"stem":412},"Media Storage","\u002Fdocs\u002Fguide\u002Fdatabases-and-storage\u002Fmedia-storage","docs\u002F2.guide\u002F3.databases-and-storage\u002F2.media-storage",{"title":414,"path":415,"stem":416},"Image Providers","\u002Fdocs\u002Fguide\u002Fdatabases-and-storage\u002Fimage-providers","docs\u002F2.guide\u002F3.databases-and-storage\u002F3.image-providers",{"title":418,"icon":6,"path":419,"stem":420,"children":421,"page":6},"Recipes","\u002Fdocs\u002Fguide\u002Frecipes","docs\u002F2.guide\u002F4.recipes",[422,426,430,434,438,442],{"title":423,"path":424,"stem":425},"Seed Content","\u002Fdocs\u002Fguide\u002Frecipes\u002Fseed-content","docs\u002F2.guide\u002F4.recipes\u002F1.seed-content",{"title":427,"path":428,"stem":429},"Tracking and Consent","\u002Fdocs\u002Fguide\u002Frecipes\u002Ftracking-and-consent","docs\u002F2.guide\u002F4.recipes\u002F2.tracking-and-consent",{"title":431,"path":432,"stem":433},"Build a Custom Field","\u002Fdocs\u002Fguide\u002Frecipes\u002Fbuild-a-custom-field","docs\u002F2.guide\u002F4.recipes\u002F3.build-a-custom-field",{"title":435,"path":436,"stem":437},"Write a Plugin","\u002Fdocs\u002Fguide\u002Frecipes\u002Fwrite-a-plugin","docs\u002F2.guide\u002F4.recipes\u002F4.write-a-plugin",{"title":439,"path":440,"stem":441},"Build a Headless Site with Next.js","\u002Fdocs\u002Fguide\u002Frecipes\u002Fbuild-a-headless-site-with-nextjs","docs\u002F2.guide\u002F4.recipes\u002F5.build-a-headless-site-with-nextjs",{"title":443,"path":444,"stem":445},"Troubleshooting","\u002Fdocs\u002Fguide\u002Frecipes\u002Ftroubleshooting","docs\u002F2.guide\u002F4.recipes\u002F6.troubleshooting",{"title":447,"icon":6,"path":448,"stem":449,"children":450,"page":6},"CLI","\u002Fdocs\u002Fcli","docs\u002F3.cli",[451,454,458,462,466,470,474],{"title":50,"path":452,"stem":453},"\u002Fdocs\u002Fcli\u002Foverview","docs\u002F3.cli\u002F1.overview",{"title":455,"path":456,"stem":457},"create-tenoncms","\u002Fdocs\u002Fcli\u002Fcreate-tenoncms","docs\u002F3.cli\u002F2.create-tenoncms",{"title":459,"path":460,"stem":461},"tenon backup","\u002Fdocs\u002Fcli\u002Fbackup","docs\u002F3.cli\u002F3.backup",{"title":463,"path":464,"stem":465},"tenon users","\u002Fdocs\u002Fcli\u002Fusers","docs\u002F3.cli\u002F4.users",{"title":467,"path":468,"stem":469},"tenon media","\u002Fdocs\u002Fcli\u002Fmedia","docs\u002F3.cli\u002F5.media",{"title":471,"path":472,"stem":473},"tenon upgrade","\u002Fdocs\u002Fcli\u002Fupgrade","docs\u002F3.cli\u002F6.upgrade",{"title":475,"path":476,"stem":477},"tenon login","\u002Fdocs\u002Fcli\u002Flogin","docs\u002F3.cli\u002F7.login",{"id":479,"title":151,"body":480,"description":2019,"extension":2020,"links":2021,"meta":2022,"navigation":650,"path":152,"seo":2023,"stem":153,"__hash__":2024},"docs\u002Fdocs\u002F1.core\u002F3.working-with-content\u002F2.writing.md",{"type":481,"value":482,"toc":2003},"minimark",[483,487,570,575,578,804,811,854,859,874,1019,1023,1041,1055,1103,1107,1117,1190,1193,1197,1204,1211,1421,1484,1499,1505,1526,1529,1534,1604,1619,1622,1630,1634,1639,1679,1694,1698,1705,1821,1854,1860,1864,1875,1897,1900,1904,1911,1964,1977,1981,1999],[484,485,486],"p",{},"Server code writes content with the same instance it reads from. Every write checks the data against your schema and runs your hooks, the same as a save in the admin.",[488,489,494],"pre",{"className":490,"code":491,"language":492,"meta":493,"style":493},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","const post = await cms.create(\"posts\", { title: \"Hello world\" });\n","ts","",[495,496,497],"code",{"__ignoreMap":493},[498,499,502,506,510,514,518,521,524,528,531,534,538,540,543,546,550,553,556,559,561,564,567],"span",{"class":500,"line":501},"line",1,[498,503,505],{"class":504},"spNyl","const",[498,507,509],{"class":508},"sTEyZ"," post ",[498,511,513],{"class":512},"sMK4o","=",[498,515,517],{"class":516},"s7zQu"," await",[498,519,520],{"class":508}," cms",[498,522,523],{"class":512},".",[498,525,527],{"class":526},"s2Zo4","create",[498,529,530],{"class":508},"(",[498,532,533],{"class":512},"\"",[498,535,537],{"class":536},"sfazB","posts",[498,539,533],{"class":512},[498,541,542],{"class":512},",",[498,544,545],{"class":512}," {",[498,547,549],{"class":548},"swJcz"," title",[498,551,552],{"class":512},":",[498,554,555],{"class":512}," \"",[498,557,558],{"class":536},"Hello world",[498,560,533],{"class":512},[498,562,563],{"class":512}," }",[498,565,566],{"class":508},")",[498,568,569],{"class":512},";\n",[571,572,574],"h2",{"id":573},"create-update-and-delete","Create, update and delete",[484,576,577],{},"Four methods change content:",[488,579,581],{"className":490,"code":580,"language":492,"meta":493,"style":493},"\u002F\u002F A new document, published at once\nconst post = await cms.create(\"posts\", { title: \"Hello world\", category: categoryId });\n\n\u002F\u002F Change some fields. The others keep their values.\nawait cms.update(\"posts\", post.id, { featured: true });\n\n\u002F\u002F Delete it\nawait cms.delete(\"posts\", post.id);\n\n\u002F\u002F Change a global\nawait cms.setGlobal(\"footer\", { copyright: \"© 2026 Example\" });\n",[495,582,583,589,645,652,658,708,713,719,750,755,761],{"__ignoreMap":493},[498,584,585],{"class":500,"line":501},[498,586,588],{"class":587},"sHwdD","\u002F\u002F A new document, published at once\n",[498,590,592,594,596,598,600,602,604,606,608,610,612,614,616,618,620,622,624,626,628,630,633,635,638,641,643],{"class":500,"line":591},2,[498,593,505],{"class":504},[498,595,509],{"class":508},[498,597,513],{"class":512},[498,599,517],{"class":516},[498,601,520],{"class":508},[498,603,523],{"class":512},[498,605,527],{"class":526},[498,607,530],{"class":508},[498,609,533],{"class":512},[498,611,537],{"class":536},[498,613,533],{"class":512},[498,615,542],{"class":512},[498,617,545],{"class":512},[498,619,549],{"class":548},[498,621,552],{"class":512},[498,623,555],{"class":512},[498,625,558],{"class":536},[498,627,533],{"class":512},[498,629,542],{"class":512},[498,631,632],{"class":548}," category",[498,634,552],{"class":512},[498,636,637],{"class":508}," categoryId ",[498,639,640],{"class":512},"}",[498,642,566],{"class":508},[498,644,569],{"class":512},[498,646,648],{"class":500,"line":647},3,[498,649,651],{"emptyLinePlaceholder":650},true,"\n",[498,653,655],{"class":500,"line":654},4,[498,656,657],{"class":587},"\u002F\u002F Change some fields. The others keep their values.\n",[498,659,661,664,666,668,671,673,675,677,679,681,684,686,689,691,693,696,698,702,704,706],{"class":500,"line":660},5,[498,662,663],{"class":516},"await",[498,665,520],{"class":508},[498,667,523],{"class":512},[498,669,670],{"class":526},"update",[498,672,530],{"class":508},[498,674,533],{"class":512},[498,676,537],{"class":536},[498,678,533],{"class":512},[498,680,542],{"class":512},[498,682,683],{"class":508}," post",[498,685,523],{"class":512},[498,687,688],{"class":508},"id",[498,690,542],{"class":512},[498,692,545],{"class":512},[498,694,695],{"class":548}," featured",[498,697,552],{"class":512},[498,699,701],{"class":700},"sfNiH"," true",[498,703,563],{"class":512},[498,705,566],{"class":508},[498,707,569],{"class":512},[498,709,711],{"class":500,"line":710},6,[498,712,651],{"emptyLinePlaceholder":650},[498,714,716],{"class":500,"line":715},7,[498,717,718],{"class":587},"\u002F\u002F Delete it\n",[498,720,722,724,726,728,731,733,735,737,739,741,743,745,748],{"class":500,"line":721},8,[498,723,663],{"class":516},[498,725,520],{"class":508},[498,727,523],{"class":512},[498,729,730],{"class":526},"delete",[498,732,530],{"class":508},[498,734,533],{"class":512},[498,736,537],{"class":536},[498,738,533],{"class":512},[498,740,542],{"class":512},[498,742,683],{"class":508},[498,744,523],{"class":512},[498,746,747],{"class":508},"id)",[498,749,569],{"class":512},[498,751,753],{"class":500,"line":752},9,[498,754,651],{"emptyLinePlaceholder":650},[498,756,758],{"class":500,"line":757},10,[498,759,760],{"class":587},"\u002F\u002F Change a global\n",[498,762,764,766,768,770,773,775,777,780,782,784,786,789,791,793,796,798,800,802],{"class":500,"line":763},11,[498,765,663],{"class":516},[498,767,520],{"class":508},[498,769,523],{"class":512},[498,771,772],{"class":526},"setGlobal",[498,774,530],{"class":508},[498,776,533],{"class":512},[498,778,779],{"class":536},"footer",[498,781,533],{"class":512},[498,783,542],{"class":512},[498,785,545],{"class":512},[498,787,788],{"class":548}," copyright",[498,790,552],{"class":512},[498,792,555],{"class":512},[498,794,795],{"class":536},"© 2026 Example",[498,797,533],{"class":512},[498,799,563],{"class":512},[498,801,566],{"class":508},[498,803,569],{"class":512},[484,805,806,807,523],{},"Use them in seed scripts, imports from other systems, server routes and ",[808,809,810],"a",{"href":172},"hooks",[812,813,814,827,834,843],"ul",{},[815,816,817,819,820,822,823,826],"li",{},[495,818,670],{}," and ",[495,821,772],{}," change only the top-level fields they receive. ",[495,824,825],{},"null"," clears a field. A group you send replaces the stored group.",[815,828,829,819,831,833],{},[495,830,527],{},[495,832,670],{}," return the stored document. Relations hold ids, not loaded documents.",[815,835,836,838,839,842],{},[495,837,670],{}," returns ",[495,840,841],{},"undefined"," when the document does not exist.",[815,844,845,846,849,850,853],{},"Writes take ",[495,847,848],{},"locale"," for a ",[808,851,852],{"href":168},"localized"," collection.",[855,856,858],"h3",{"id":857},"invalid-data","Invalid data",[484,860,861,862,865,866,869,870,873],{},"A write with invalid data throws a ",[495,863,864],{},"ValidationError"," from ",[495,867,868],{},"tenoncms"," and stores nothing. ",[495,871,872],{},"errors"," holds one message per field path:",[488,875,877],{"className":490,"code":876,"language":492,"meta":493,"style":493},"import { ValidationError } from \"tenoncms\";\n\ntry {\n  \u002F\u002F `title` is required\n  await cms.create(\"posts\", {});\n} catch (error) {\n  if (error instanceof ValidationError) {\n    \u002F\u002F { title: \"\u003Cmessage>\" }\n    console.log(error.errors);\n  }\n}\n",[495,878,879,902,906,914,919,947,960,982,987,1009,1014],{"__ignoreMap":493},[498,880,881,884,886,889,891,894,896,898,900],{"class":500,"line":501},[498,882,883],{"class":516},"import",[498,885,545],{"class":512},[498,887,888],{"class":508}," ValidationError",[498,890,563],{"class":512},[498,892,893],{"class":516}," from",[498,895,555],{"class":512},[498,897,868],{"class":536},[498,899,533],{"class":512},[498,901,569],{"class":512},[498,903,904],{"class":500,"line":591},[498,905,651],{"emptyLinePlaceholder":650},[498,907,908,911],{"class":500,"line":647},[498,909,910],{"class":516},"try",[498,912,913],{"class":512}," {\n",[498,915,916],{"class":500,"line":654},[498,917,918],{"class":587},"  \u002F\u002F `title` is required\n",[498,920,921,924,926,928,930,932,934,936,938,940,943,945],{"class":500,"line":660},[498,922,923],{"class":516},"  await",[498,925,520],{"class":508},[498,927,523],{"class":512},[498,929,527],{"class":526},[498,931,530],{"class":548},[498,933,533],{"class":512},[498,935,537],{"class":536},[498,937,533],{"class":512},[498,939,542],{"class":512},[498,941,942],{"class":512}," {}",[498,944,566],{"class":548},[498,946,569],{"class":512},[498,948,949,951,954,957],{"class":500,"line":710},[498,950,640],{"class":512},[498,952,953],{"class":516}," catch",[498,955,956],{"class":508}," (error) ",[498,958,959],{"class":512},"{\n",[498,961,962,965,968,971,974,977,980],{"class":500,"line":715},[498,963,964],{"class":516},"  if",[498,966,967],{"class":548}," (",[498,969,970],{"class":508},"error",[498,972,973],{"class":512}," instanceof",[498,975,888],{"class":976},"sBMFI",[498,978,979],{"class":548},") ",[498,981,959],{"class":512},[498,983,984],{"class":500,"line":721},[498,985,986],{"class":587},"    \u002F\u002F { title: \"\u003Cmessage>\" }\n",[498,988,989,992,994,997,999,1001,1003,1005,1007],{"class":500,"line":752},[498,990,991],{"class":508},"    console",[498,993,523],{"class":512},[498,995,996],{"class":526},"log",[498,998,530],{"class":548},[498,1000,970],{"class":508},[498,1002,523],{"class":512},[498,1004,872],{"class":508},[498,1006,566],{"class":548},[498,1008,569],{"class":512},[498,1010,1011],{"class":500,"line":757},[498,1012,1013],{"class":512},"  }\n",[498,1015,1016],{"class":500,"line":763},[498,1017,1018],{"class":512},"}\n",[855,1020,1022],{"id":1021},"deletes-and-references","Deletes and references",[484,1024,1025,1026,1029,1030,1033,1034,1037,1038,523],{},"When you delete a document, every relation that points to it applies its ",[495,1027,1028],{},"onDelete"," rule. A ",[495,1031,1032],{},"restrict"," rule stops the delete with a ",[495,1035,1036],{},"ConflictError",". See ",[808,1039,112],{"href":1040},"\u002Fdocs\u002Fcore\u002Fcontent-modeling\u002Frelations#when-a-document-is-deleted",[484,1042,1043,1044,1047,1048,1051,1052,552],{},"Links in rich text and ",[495,1045,1046],{},"link"," fields protect their target too. A delete that would break such a link throws a ",[495,1049,1050],{},"LinkedContentError"," that lists the documents with the link. To delete anyway, pass ",[495,1053,1054],{},"allowBrokenLinks",[488,1056,1058],{"className":490,"code":1057,"language":492,"meta":493,"style":493},"await cms.delete(\"posts\", post.id, { allowBrokenLinks: true });\n",[495,1059,1060],{"__ignoreMap":493},[498,1061,1062,1064,1066,1068,1070,1072,1074,1076,1078,1080,1082,1084,1086,1088,1090,1093,1095,1097,1099,1101],{"class":500,"line":501},[498,1063,663],{"class":516},[498,1065,520],{"class":508},[498,1067,523],{"class":512},[498,1069,730],{"class":526},[498,1071,530],{"class":508},[498,1073,533],{"class":512},[498,1075,537],{"class":536},[498,1077,533],{"class":512},[498,1079,542],{"class":512},[498,1081,683],{"class":508},[498,1083,523],{"class":512},[498,1085,688],{"class":508},[498,1087,542],{"class":512},[498,1089,545],{"class":512},[498,1091,1092],{"class":548}," allowBrokenLinks",[498,1094,552],{"class":512},[498,1096,701],{"class":700},[498,1098,563],{"class":512},[498,1100,566],{"class":508},[498,1102,569],{"class":512},[855,1104,1106],{"id":1105},"access-rules","Access rules",[484,1108,1109,1110,1113,1114,552],{},"The instance you import skips the ",[808,1111,1112],{"href":206},"access rules",". Your server code is trusted. To write as the user of a request, use ",[495,1115,1116],{},"cms.withSession(request)",[488,1118,1120],{"className":490,"code":1119,"language":492,"meta":493,"style":493},"const tenon = await cms.withSession(request);\nawait tenon.update(\"posts\", id, { title: \"New title\" });\n",[495,1121,1122,1145],{"__ignoreMap":493},[498,1123,1124,1126,1129,1131,1133,1135,1137,1140,1143],{"class":500,"line":501},[498,1125,505],{"class":504},[498,1127,1128],{"class":508}," tenon ",[498,1130,513],{"class":512},[498,1132,517],{"class":516},[498,1134,520],{"class":508},[498,1136,523],{"class":512},[498,1138,1139],{"class":526},"withSession",[498,1141,1142],{"class":508},"(request)",[498,1144,569],{"class":512},[498,1146,1147,1149,1152,1154,1156,1158,1160,1162,1164,1166,1169,1171,1173,1175,1177,1179,1182,1184,1186,1188],{"class":500,"line":591},[498,1148,663],{"class":516},[498,1150,1151],{"class":508}," tenon",[498,1153,523],{"class":512},[498,1155,670],{"class":526},[498,1157,530],{"class":508},[498,1159,533],{"class":512},[498,1161,537],{"class":536},[498,1163,533],{"class":512},[498,1165,542],{"class":512},[498,1167,1168],{"class":508}," id",[498,1170,542],{"class":512},[498,1172,545],{"class":512},[498,1174,549],{"class":548},[498,1176,552],{"class":512},[498,1178,555],{"class":512},[498,1180,1181],{"class":536},"New title",[498,1183,533],{"class":512},[498,1185,563],{"class":512},[498,1187,566],{"class":508},[498,1189,569],{"class":512},[484,1191,1192],{},"Its writes apply the rules for that user. A field that the user may not change keeps its stored value, and the input for it is dropped.",[571,1194,1196],{"id":1195},"drafts","Drafts",[484,1198,1199,1200,1203],{},"Every collection and global has drafts, unless it sets ",[495,1201,1202],{},"drafts: false",". A document then has a published version, and may have a pending draft next to it. Visitors see only the published version.",[484,1205,1206,1207,1210],{},"Writes publish by default. ",[495,1208,1209],{},"{ draft: true }"," saves a draft instead and keeps the published data:",[488,1212,1214],{"className":490,"code":1213,"language":492,"meta":493,"style":493},"\u002F\u002F A new document that is not live yet\nconst post = await cms.create(\"posts\", { title: \"Coming soon\" }, { draft: true });\n\n\u002F\u002F Change the draft\nawait cms.update(\"posts\", post.id, { body: \"…\" }, { draft: true });\n\n\u002F\u002F Make the draft live\nawait cms.publish(\"posts\", post.id);\n\n\u002F\u002F Drop the draft\nawait cms.discard(\"posts\", post.id);\n",[495,1215,1216,1221,1278,1282,1287,1345,1349,1354,1383,1387,1392],{"__ignoreMap":493},[498,1217,1218],{"class":500,"line":501},[498,1219,1220],{"class":587},"\u002F\u002F A new document that is not live yet\n",[498,1222,1223,1225,1227,1229,1231,1233,1235,1237,1239,1241,1243,1245,1247,1249,1251,1253,1255,1258,1260,1263,1265,1268,1270,1272,1274,1276],{"class":500,"line":591},[498,1224,505],{"class":504},[498,1226,509],{"class":508},[498,1228,513],{"class":512},[498,1230,517],{"class":516},[498,1232,520],{"class":508},[498,1234,523],{"class":512},[498,1236,527],{"class":526},[498,1238,530],{"class":508},[498,1240,533],{"class":512},[498,1242,537],{"class":536},[498,1244,533],{"class":512},[498,1246,542],{"class":512},[498,1248,545],{"class":512},[498,1250,549],{"class":548},[498,1252,552],{"class":512},[498,1254,555],{"class":512},[498,1256,1257],{"class":536},"Coming soon",[498,1259,533],{"class":512},[498,1261,1262],{"class":512}," },",[498,1264,545],{"class":512},[498,1266,1267],{"class":548}," draft",[498,1269,552],{"class":512},[498,1271,701],{"class":700},[498,1273,563],{"class":512},[498,1275,566],{"class":508},[498,1277,569],{"class":512},[498,1279,1280],{"class":500,"line":647},[498,1281,651],{"emptyLinePlaceholder":650},[498,1283,1284],{"class":500,"line":654},[498,1285,1286],{"class":587},"\u002F\u002F Change the draft\n",[498,1288,1289,1291,1293,1295,1297,1299,1301,1303,1305,1307,1309,1311,1313,1315,1317,1320,1322,1324,1327,1329,1331,1333,1335,1337,1339,1341,1343],{"class":500,"line":660},[498,1290,663],{"class":516},[498,1292,520],{"class":508},[498,1294,523],{"class":512},[498,1296,670],{"class":526},[498,1298,530],{"class":508},[498,1300,533],{"class":512},[498,1302,537],{"class":536},[498,1304,533],{"class":512},[498,1306,542],{"class":512},[498,1308,683],{"class":508},[498,1310,523],{"class":512},[498,1312,688],{"class":508},[498,1314,542],{"class":512},[498,1316,545],{"class":512},[498,1318,1319],{"class":548}," body",[498,1321,552],{"class":512},[498,1323,555],{"class":512},[498,1325,1326],{"class":536},"…",[498,1328,533],{"class":512},[498,1330,1262],{"class":512},[498,1332,545],{"class":512},[498,1334,1267],{"class":548},[498,1336,552],{"class":512},[498,1338,701],{"class":700},[498,1340,563],{"class":512},[498,1342,566],{"class":508},[498,1344,569],{"class":512},[498,1346,1347],{"class":500,"line":710},[498,1348,651],{"emptyLinePlaceholder":650},[498,1350,1351],{"class":500,"line":715},[498,1352,1353],{"class":587},"\u002F\u002F Make the draft live\n",[498,1355,1356,1358,1360,1362,1365,1367,1369,1371,1373,1375,1377,1379,1381],{"class":500,"line":721},[498,1357,663],{"class":516},[498,1359,520],{"class":508},[498,1361,523],{"class":512},[498,1363,1364],{"class":526},"publish",[498,1366,530],{"class":508},[498,1368,533],{"class":512},[498,1370,537],{"class":536},[498,1372,533],{"class":512},[498,1374,542],{"class":512},[498,1376,683],{"class":508},[498,1378,523],{"class":512},[498,1380,747],{"class":508},[498,1382,569],{"class":512},[498,1384,1385],{"class":500,"line":752},[498,1386,651],{"emptyLinePlaceholder":650},[498,1388,1389],{"class":500,"line":757},[498,1390,1391],{"class":587},"\u002F\u002F Drop the draft\n",[498,1393,1394,1396,1398,1400,1403,1405,1407,1409,1411,1413,1415,1417,1419],{"class":500,"line":763},[498,1395,663],{"class":516},[498,1397,520],{"class":508},[498,1399,523],{"class":512},[498,1401,1402],{"class":526},"discard",[498,1404,530],{"class":508},[498,1406,533],{"class":512},[498,1408,537],{"class":536},[498,1410,533],{"class":512},[498,1412,542],{"class":512},[498,1414,683],{"class":508},[498,1416,523],{"class":512},[498,1418,747],{"class":508},[498,1420,569],{"class":512},[812,1422,1423,1446,1454,1461,1471],{},[815,1424,1425,1426,1429,1430,1429,1433,1429,1436,1429,1439,1429,1442,1445],{},"A draft save checks only the value types. ",[495,1427,1428],{},"required",", ",[495,1431,1432],{},"pattern",[495,1434,1435],{},"min",[495,1437,1438],{},"max",[495,1440,1441],{},"validate",[495,1443,1444],{},"unique"," and relation ids wait for the publish.",[815,1447,1448,1450,1451,1453],{},[495,1449,1364],{}," runs every check of a normal save on the draft. If one fails, it throws a ",[495,1452,864],{}," and the draft stays.",[815,1455,1456,1458,1459,523],{},[495,1457,1402],{}," drops the draft and returns the published document. A document that was never published is deleted, and the result is ",[495,1460,841],{},[815,1462,1463,1466,1467,1470],{},[495,1464,1465],{},"afterChange"," hooks run on a publish, not on a draft save. Hooks get ",[495,1468,1469],{},"draft: true"," on a draft save.",[815,1472,1473,1474,1477,1478,1480,1481,523],{},"Every document has ",[495,1475,1476],{},"publishedAt",", which is ",[495,1479,825],{}," when it was never published, and ",[495,1482,1483],{},"hasDraft",[484,1485,1486,1487,1429,1490,1429,1493,819,1496,523],{},"Globals have the same methods: ",[495,1488,1489],{},"setGlobal(name, data, { draft: true })",[495,1491,1492],{},"publishGlobal()",[495,1494,1495],{},"unpublishGlobal()",[495,1497,1498],{},"discardGlobal()",[484,1500,1501,1502,523],{},"To read drafts, see ",[808,1503,147],{"href":1504},"\u002Fdocs\u002Fcore\u002Fworking-with-content\u002Freading#drafts",[1506,1507,1508,1509,1511,1512,1429,1514,1429,1517,819,1519,1522,1523,1525],"note",{},"With ",[495,1510,1202],{},", every save is live at once. ",[495,1513,1209],{},[495,1515,1516],{},"unpublish",[495,1518,1402],{},[495,1520,1521],{},"schedule"," then throw a ",[495,1524,864],{},". The media library has no drafts.",[855,1527,1528],{"id":1516},"Unpublish",[484,1530,1531,1533],{},[495,1532,1516],{}," takes a document offline and keeps its content:",[488,1535,1537],{"className":490,"code":1536,"language":492,"meta":493,"style":493},"await cms.unpublish(\"posts\", post.id);\n\n\u002F\u002F Live again\nawait cms.publish(\"posts\", post.id);\n",[495,1538,1539,1567,1571,1576],{"__ignoreMap":493},[498,1540,1541,1543,1545,1547,1549,1551,1553,1555,1557,1559,1561,1563,1565],{"class":500,"line":501},[498,1542,663],{"class":516},[498,1544,520],{"class":508},[498,1546,523],{"class":512},[498,1548,1516],{"class":526},[498,1550,530],{"class":508},[498,1552,533],{"class":512},[498,1554,537],{"class":536},[498,1556,533],{"class":512},[498,1558,542],{"class":512},[498,1560,683],{"class":508},[498,1562,523],{"class":512},[498,1564,747],{"class":508},[498,1566,569],{"class":512},[498,1568,1569],{"class":500,"line":591},[498,1570,651],{"emptyLinePlaceholder":650},[498,1572,1573],{"class":500,"line":647},[498,1574,1575],{"class":587},"\u002F\u002F Live again\n",[498,1577,1578,1580,1582,1584,1586,1588,1590,1592,1594,1596,1598,1600,1602],{"class":500,"line":654},[498,1579,663],{"class":516},[498,1581,520],{"class":508},[498,1583,523],{"class":512},[498,1585,1364],{"class":526},[498,1587,530],{"class":508},[498,1589,533],{"class":512},[498,1591,537],{"class":536},[498,1593,533],{"class":512},[498,1595,542],{"class":512},[498,1597,683],{"class":508},[498,1599,523],{"class":512},[498,1601,747],{"class":508},[498,1603,569],{"class":512},[812,1605,1606,1609,1612],{},[815,1607,1608],{},"A pending draft stays. Without one, the published data becomes the draft, so nothing is lost.",[815,1610,1611],{},"Its unique values, like the slug, stay reserved. A later publish does not fail because another document took the slug.",[815,1613,1614,1615,1618],{},"In a localized collection, ",[495,1616,1617],{},"{ locale }"," takes one language offline. The document goes offline with its last published language.",[855,1620,1621],{"id":1521},"Schedule",[484,1623,1624,1627,1628,523],{},[495,1625,1626],{},"schedule: true"," on a collection or global lets editors plan a publish or an unpublish for a later time. A built-in job runs it. See ",[808,1629,155],{"href":156},[855,1631,1633],{"id":1632},"duplicate","Duplicate",[484,1635,1636,1638],{},[495,1637,1632],{}," copies a document, with every language, into a new draft:",[488,1640,1642],{"className":490,"code":1641,"language":492,"meta":493,"style":493},"const copy = await cms.duplicate(\"posts\", post.id);\n",[495,1643,1644],{"__ignoreMap":493},[498,1645,1646,1648,1651,1653,1655,1657,1659,1661,1663,1665,1667,1669,1671,1673,1675,1677],{"class":500,"line":501},[498,1647,505],{"class":504},[498,1649,1650],{"class":508}," copy ",[498,1652,513],{"class":512},[498,1654,517],{"class":516},[498,1656,520],{"class":508},[498,1658,523],{"class":512},[498,1660,1632],{"class":526},[498,1662,530],{"class":508},[498,1664,533],{"class":512},[498,1666,537],{"class":536},[498,1668,533],{"class":512},[498,1670,542],{"class":512},[498,1672,683],{"class":508},[498,1674,523],{"class":512},[498,1676,747],{"class":508},[498,1678,569],{"class":512},[484,1680,1681,1682,1685,1686,1689,1690,1693],{},"The title gets ",[495,1683,1684],{}," (copy)",". A slug or another unique text gets ",[495,1687,1688],{},"-copy",", then ",[495,1691,1692],{},"-copy-2"," and so on, so the copy saves without edits.",[571,1695,1697],{"id":1696},"edit-conflicts","Edit conflicts",[484,1699,1700,1701,1704],{},"Two people can change the same document at once. Without a check, the last save wins. To catch this, send the ",[495,1702,1703],{},"updatedAt"," you loaded:",[488,1706,1708],{"className":490,"code":1707,"language":492,"meta":493,"style":493},"const post = await cms.withDrafts().findById(\"posts\", id);\n\nawait cms.update(\"posts\", id, { title: \"New title\" }, { draft: true, updatedAt: post?.updatedAt });\n",[495,1709,1710,1750,1754],{"__ignoreMap":493},[498,1711,1712,1714,1716,1718,1720,1722,1724,1727,1730,1732,1735,1737,1739,1741,1743,1745,1748],{"class":500,"line":501},[498,1713,505],{"class":504},[498,1715,509],{"class":508},[498,1717,513],{"class":512},[498,1719,517],{"class":516},[498,1721,520],{"class":508},[498,1723,523],{"class":512},[498,1725,1726],{"class":526},"withDrafts",[498,1728,1729],{"class":508},"()",[498,1731,523],{"class":512},[498,1733,1734],{"class":526},"findById",[498,1736,530],{"class":508},[498,1738,533],{"class":512},[498,1740,537],{"class":536},[498,1742,533],{"class":512},[498,1744,542],{"class":512},[498,1746,1747],{"class":508}," id)",[498,1749,569],{"class":512},[498,1751,1752],{"class":500,"line":591},[498,1753,651],{"emptyLinePlaceholder":650},[498,1755,1756,1758,1760,1762,1764,1766,1768,1770,1772,1774,1776,1778,1780,1782,1784,1786,1788,1790,1792,1794,1796,1798,1800,1802,1805,1807,1809,1812,1815,1817,1819],{"class":500,"line":647},[498,1757,663],{"class":516},[498,1759,520],{"class":508},[498,1761,523],{"class":512},[498,1763,670],{"class":526},[498,1765,530],{"class":508},[498,1767,533],{"class":512},[498,1769,537],{"class":536},[498,1771,533],{"class":512},[498,1773,542],{"class":512},[498,1775,1168],{"class":508},[498,1777,542],{"class":512},[498,1779,545],{"class":512},[498,1781,549],{"class":548},[498,1783,552],{"class":512},[498,1785,555],{"class":512},[498,1787,1181],{"class":536},[498,1789,533],{"class":512},[498,1791,1262],{"class":512},[498,1793,545],{"class":512},[498,1795,1267],{"class":548},[498,1797,552],{"class":512},[498,1799,701],{"class":700},[498,1801,542],{"class":512},[498,1803,1804],{"class":548}," updatedAt",[498,1806,552],{"class":512},[498,1808,683],{"class":508},[498,1810,1811],{"class":512},"?.",[498,1813,1814],{"class":508},"updatedAt ",[498,1816,640],{"class":512},[498,1818,566],{"class":508},[498,1820,569],{"class":512},[484,1822,1823,1824,1826,1827,1830,1831,1429,1833,1429,1835,1429,1837,819,1840,1843,1844,1846,1847,1850,1851,523],{},"If someone saved since, the write throws a ",[495,1825,1036],{}," with ",[495,1828,1829],{},"code: \"CHANGED\"",", and changes nothing. ",[495,1832,1364],{},[495,1834,1516],{},[495,1836,772],{},[495,1838,1839],{},"publishGlobal",[495,1841,1842],{},"unpublishGlobal"," take ",[495,1845,1703],{}," too. Over HTTP, it is the ",[495,1848,1849],{},"?updatedAt="," query, and the answer is ",[495,1852,1853],{},"409",[484,1855,1856,1857,1859],{},"The admin sends ",[495,1858,1703],{}," with every save. It also lets one person edit a document at a time. These locks only guide the admin. The API does not enforce them.",[571,1861,1863],{"id":1862},"version-history","Version history",[484,1865,1866,1867,1870,1871,1874],{},"Every document and global keeps its past versions, per language. Editors open them in the admin, under ",[1868,1869,1326],"strong",{}," → ",[1868,1872,1873],{},"History",", and can restore one.",[812,1876,1877,1880,1883,1886],{},[815,1878,1879],{},"A publish, and every save without drafts, adds a version. An unpublish adds one with the content that went offline.",[815,1881,1882],{},"The draft saves of one editor update the same version until 30 minutes pass without a save, or someone else saves.",[815,1884,1885],{},"A restore writes the version back as the draft, through a normal write, so access rules, hooks and validation apply.",[815,1887,1888,1889,1892,1893,1896],{},"Each document keeps its newest 100 versions per language. Set ",[495,1890,1891],{},"maxVersions"," on the collection or global to change this, or ",[495,1894,1895],{},"Infinity"," to keep all.",[484,1898,1899],{},"Server code records no user on a version.",[571,1901,1903],{"id":1902},"from-the-browser","From the browser",[484,1905,1906,1907,1910],{},"The ",[808,1908,1909],{"href":160},"client"," has the same writes. Draft saves have their own methods there:",[1912,1913,1914,1925],"table",{},[1915,1916,1917],"thead",{},[1918,1919,1920,1923],"tr",{},[1921,1922,333],"th",{},[1921,1924,337],{},[1926,1927,1928,1941,1953],"tbody",{},[1918,1929,1930,1936],{},[1931,1932,1933],"td",{},[495,1934,1935],{},"create(name, data, { draft: true })",[1931,1937,1938],{},[495,1939,1940],{},"createDraft(name, data)",[1918,1942,1943,1948],{},[1931,1944,1945],{},[495,1946,1947],{},"update(name, id, data, { draft: true })",[1931,1949,1950],{},[495,1951,1952],{},"updateDraft(name, id, data)",[1918,1954,1955,1959],{},[1931,1956,1957],{},[495,1958,1489],{},[1931,1960,1961],{},[495,1962,1963],{},"setGlobalDraft(name, data)",[484,1965,1966,1429,1968,1429,1970,1429,1972,819,1974,1976],{},[495,1967,1364],{},[495,1969,1516],{},[495,1971,1402],{},[495,1973,1521],{},[495,1975,1632],{}," have the same names. Every write over HTTP needs a session or an API key, unless an access rule allows it.",[571,1978,1980],{"id":1979},"related-resources","Related resources",[812,1982,1983,1988,1994],{},[815,1984,1985,1987],{},[808,1986,171],{"href":172},": run code on every write.",[815,1989,1990,1993],{},[808,1991,1992],{"href":193},"Live preview",": show drafts on the real page.",[815,1995,1996,1998],{},[808,1997,333],{"href":334},": every method and its options.",[2000,2001,2002],"style",{},"html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sHwdD, html code.shiki .sHwdD{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic}html pre.shiki code .sfNiH, html code.shiki .sfNiH{--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC}html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}",{"title":493,"searchDepth":591,"depth":591,"links":2004},[2005,2010,2015,2016,2017,2018],{"id":573,"depth":591,"text":574,"children":2006},[2007,2008,2009],{"id":857,"depth":647,"text":858},{"id":1021,"depth":647,"text":1022},{"id":1105,"depth":647,"text":1106},{"id":1195,"depth":591,"text":1196,"children":2011},[2012,2013,2014],{"id":1516,"depth":647,"text":1528},{"id":1521,"depth":647,"text":1621},{"id":1632,"depth":647,"text":1633},{"id":1696,"depth":591,"text":1697},{"id":1862,"depth":591,"text":1863},{"id":1902,"depth":591,"text":1903},{"id":1979,"depth":591,"text":1980},"Create, update and delete content from server code, with drafts, publishing and schedules.","md",null,{},{"title":151,"description":2019},"VkCXPpjhVKZIyJ0VwYkthxl8HTWHdvLHMWee9gzYa84",[2026,2028],{"title":147,"path":148,"stem":149,"description":2027,"children":-1},"Query content from server code, typed from the schema.",{"title":155,"path":156,"stem":157,"description":2029,"children":-1},"Publish or unpublish a document at a set time, with a built-in job.",1795884672434]