[{"data":1,"prerenderedAt":3243},["ShallowReactive",2],{"navigation_docs":3,"-docs-guide-recipes-build-a-headless-site-with-nextjs":478,"-docs-guide-recipes-build-a-headless-site-with-nextjs-surround":3238},[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":439,"body":480,"description":3232,"extension":3233,"links":3234,"meta":3235,"navigation":735,"path":440,"seo":3236,"stem":441,"__hash__":3237},"docs\u002Fdocs\u002F2.guide\u002F4.recipes\u002F5.build-a-headless-site-with-nextjs.md",{"type":481,"value":482,"toc":3212},"minimark",[483,487,494,512,521,526,548,559,563,1169,1173,2926,2930,2982,2989,2993,3003,3129,3149,3157,3161,3208],[484,485,486],"p",{},"This recipe builds a Next.js site that reads its content from a Tenon CMS on another origin. Visitors see published content. A signed-in editor sees drafts, gets the admin bar on the site, and edits the page live in the admin's visual editor.",[484,488,489,490,493],{},"Next.js is not built on Vite, so Tenon cannot run inside it. The CMS runs as a ",[491,492,376],"a",{"href":377}," project, and the site reads from it over HTTP. The same steps work for any server-rendered JavaScript framework.",[495,496,497,498,507,508,511],"tip",{},"The finished code is in ",[491,499,503],{"href":500,"rel":501},"https:\u002F\u002Fgithub.com\u002FSuddenDev\u002FTenonCMS\u002Ftree\u002Fmain\u002Fexamples\u002Fheadless-nextjs",[502],"nofollow",[504,505,506],"code",{},"examples\u002Fheadless-nextjs",". It uses ",[504,509,510],{},"tenoncms"," from npm, so you can copy the folder and run it.",[513,514,515,516,520],"warning",{},"Headless use is experimental. Expect gaps and changes. See the ",[491,517,519],{"href":518},"\u002Fdocs\u002Fcore\u002Fworking-with-content\u002Fheadless#limits","limits",".",[522,523,525],"h2",{"id":524},"before-you-start","Before you start",[527,528,529,543],"ul",{},[530,531,532,533],"li",{},"One folder that holds both projects, so the site can import the CMS types:",[534,535,541],"pre",{"className":536,"code":538,"language":539,"meta":540},[537],"language-text","my-project\u002F\n├── cms\u002F    the Tenon CMS, on http:\u002F\u002Flocalhost:3200\n└── site\u002F   the Next.js site, on http:\u002F\u002Flocalhost:3000\n","text","",[504,542,538],{"__ignoreMap":540},[530,544,545,547],{},[491,546,163],{"href":164}," explains the origins, the cookies and the limits. This recipe only shows the steps.",[484,549,550,551,554,555,558],{},"File names below are relative to the project of each section: ",[504,552,553],{},"cms\u002F"," while you set up the CMS, ",[504,556,557],{},"site\u002F"," while you build the site.",[522,560,562],{"id":561},"set-up-the-cms","Set up the CMS",[564,565,567,572,590,669,680,684,691,959,963,977,1081,1087,1111,1123,1127,1130,1162],"steps",{"level":566},"3",[568,569,571],"h3",{"id":570},"create-the-cms","Create the CMS",[484,573,574,575,578,579,582,583,586,587,589],{},"In ",[504,576,577],{},"my-project",", create a Tenon project in the folder ",[504,580,581],{},"cms",". Pick ",[584,585,376],"strong",{},", then ",[584,588,390],{},":",[591,592,594,620,637,653],"code-group",{"sync":593},"pm",[534,595,600],{"className":596,"code":597,"filename":598,"language":599,"meta":540,"style":540},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","npm create tenoncms@latest cms\n","npm","bash",[504,601,602],{"__ignoreMap":540},[603,604,607,610,614,617],"span",{"class":605,"line":606},"line",1,[603,608,598],{"class":609},"sBMFI",[603,611,613],{"class":612},"sfazB"," create",[603,615,616],{"class":612}," tenoncms@latest",[603,618,619],{"class":612}," cms\n",[534,621,624],{"className":596,"code":622,"filename":623,"language":599,"meta":540,"style":540},"pnpm create tenoncms cms\n","pnpm",[504,625,626],{"__ignoreMap":540},[603,627,628,630,632,635],{"class":605,"line":606},[603,629,623],{"class":609},[603,631,613],{"class":612},[603,633,634],{"class":612}," tenoncms",[603,636,619],{"class":612},[534,638,641],{"className":596,"code":639,"filename":640,"language":599,"meta":540,"style":540},"yarn create tenoncms cms\n","yarn",[504,642,643],{"__ignoreMap":540},[603,644,645,647,649,651],{"class":605,"line":606},[603,646,640],{"class":609},[603,648,613],{"class":612},[603,650,634],{"class":612},[603,652,619],{"class":612},[534,654,657],{"className":596,"code":655,"filename":656,"language":599,"meta":540,"style":540},"bun create tenoncms cms\n","bun",[504,658,659],{"__ignoreMap":540},[603,660,661,663,665,667],{"class":605,"line":606},[603,662,656],{"class":609},[603,664,613],{"class":612},[603,666,634],{"class":612},[603,668,619],{"class":612},[484,670,671,672,675,676,679],{},"The starter has a ",[504,673,674],{},"posts"," collection with ",[504,677,678],{},"permalink: \"\u002Fposts\u002F{slug}\"",". The admin uses the permalink to open a post on the site.",[568,681,683],{"id":682},"add-a-cover-image","Add a cover image",[484,685,686,687,690],{},"Add an ",[504,688,689],{},"image"," field to the collection, so the site can show a picture:",[534,692,697],{"className":693,"code":694,"filename":695,"language":696,"meta":540,"style":540},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import { defineCollection } from \"tenoncms\";\n\nexport const posts = defineCollection({\n  titleField: \"title\",\n  permalink: \"\u002Fposts\u002F{slug}\",\n  fields: {\n    title: { type: \"text\", required: true },\n    slug: { type: \"slug\", from: \"title\", required: true, unique: true },\n    cover: { type: \"image\" },\n    body: { type: \"textarea\" },\n  },\n});\n","cms\u002Fcollections\u002Fposts.ts","ts",[504,698,699,730,737,762,781,798,809,845,897,919,942,948],{"__ignoreMap":540},[603,700,701,705,709,713,716,719,722,724,727],{"class":605,"line":606},[603,702,704],{"class":703},"s7zQu","import",[603,706,708],{"class":707},"sMK4o"," {",[603,710,712],{"class":711},"sTEyZ"," defineCollection",[603,714,715],{"class":707}," }",[603,717,718],{"class":703}," from",[603,720,721],{"class":707}," \"",[603,723,510],{"class":612},[603,725,726],{"class":707},"\"",[603,728,729],{"class":707},";\n",[603,731,733],{"class":605,"line":732},2,[603,734,736],{"emptyLinePlaceholder":735},true,"\n",[603,738,740,743,747,750,753,756,759],{"class":605,"line":739},3,[603,741,742],{"class":703},"export",[603,744,746],{"class":745},"spNyl"," const",[603,748,749],{"class":711}," posts ",[603,751,752],{"class":707},"=",[603,754,712],{"class":755},"s2Zo4",[603,757,758],{"class":711},"(",[603,760,761],{"class":707},"{\n",[603,763,765,769,771,773,776,778],{"class":605,"line":764},4,[603,766,768],{"class":767},"swJcz","  titleField",[603,770,589],{"class":707},[603,772,721],{"class":707},[603,774,775],{"class":612},"title",[603,777,726],{"class":707},[603,779,780],{"class":707},",\n",[603,782,784,787,789,791,794,796],{"class":605,"line":783},5,[603,785,786],{"class":767},"  permalink",[603,788,589],{"class":707},[603,790,721],{"class":707},[603,792,793],{"class":612},"\u002Fposts\u002F{slug}",[603,795,726],{"class":707},[603,797,780],{"class":707},[603,799,801,804,806],{"class":605,"line":800},6,[603,802,803],{"class":767},"  fields",[603,805,589],{"class":707},[603,807,808],{"class":707}," {\n",[603,810,812,815,817,819,822,824,826,828,830,833,836,838,842],{"class":605,"line":811},7,[603,813,814],{"class":767},"    title",[603,816,589],{"class":707},[603,818,708],{"class":707},[603,820,821],{"class":767}," type",[603,823,589],{"class":707},[603,825,721],{"class":707},[603,827,539],{"class":612},[603,829,726],{"class":707},[603,831,832],{"class":707},",",[603,834,835],{"class":767}," required",[603,837,589],{"class":707},[603,839,841],{"class":840},"sfNiH"," true",[603,843,844],{"class":707}," },\n",[603,846,848,851,853,855,857,859,861,864,866,868,870,872,874,876,878,880,882,884,886,888,891,893,895],{"class":605,"line":847},8,[603,849,850],{"class":767},"    slug",[603,852,589],{"class":707},[603,854,708],{"class":707},[603,856,821],{"class":767},[603,858,589],{"class":707},[603,860,721],{"class":707},[603,862,863],{"class":612},"slug",[603,865,726],{"class":707},[603,867,832],{"class":707},[603,869,718],{"class":767},[603,871,589],{"class":707},[603,873,721],{"class":707},[603,875,775],{"class":612},[603,877,726],{"class":707},[603,879,832],{"class":707},[603,881,835],{"class":767},[603,883,589],{"class":707},[603,885,841],{"class":840},[603,887,832],{"class":707},[603,889,890],{"class":767}," unique",[603,892,589],{"class":707},[603,894,841],{"class":840},[603,896,844],{"class":707},[603,898,900,903,905,907,909,911,913,915,917],{"class":605,"line":899},9,[603,901,902],{"class":767},"    cover",[603,904,589],{"class":707},[603,906,708],{"class":707},[603,908,821],{"class":767},[603,910,589],{"class":707},[603,912,721],{"class":707},[603,914,689],{"class":612},[603,916,726],{"class":707},[603,918,844],{"class":707},[603,920,922,925,927,929,931,933,935,938,940],{"class":605,"line":921},10,[603,923,924],{"class":767},"    body",[603,926,589],{"class":707},[603,928,708],{"class":707},[603,930,821],{"class":767},[603,932,589],{"class":707},[603,934,721],{"class":707},[603,936,937],{"class":612},"textarea",[603,939,726],{"class":707},[603,941,844],{"class":707},[603,943,945],{"class":605,"line":944},11,[603,946,947],{"class":707},"  },\n",[603,949,951,954,957],{"class":605,"line":950},12,[603,952,953],{"class":707},"}",[603,955,956],{"class":711},")",[603,958,729],{"class":707},[568,960,962],{"id":961},"set-both-origins","Set both origins",[484,964,965,966,969,970,973,974,589],{},"The CMS MUST know the site's origin and its own. The standalone starter reads both from the environment. If your ",[504,967,968],{},"tenon.config.ts"," has no ",[504,971,972],{},"auth.baseURL"," yet, add it next to ",[504,975,976],{},"site.url",[534,978,980],{"className":693,"code":979,"filename":968,"language":696,"meta":540,"style":540},"export default defineCms({\n  \u002F\u002F ...\n  site: { url: process.env.TENON_SITE_URL, name: \"My Site\" },\n  auth: { baseURL: process.env.TENON_CMS_URL },\n});\n",[504,981,982,996,1002,1045,1073],{"__ignoreMap":540},[603,983,984,986,989,992,994],{"class":605,"line":606},[603,985,742],{"class":703},[603,987,988],{"class":703}," default",[603,990,991],{"class":755}," defineCms",[603,993,758],{"class":711},[603,995,761],{"class":707},[603,997,998],{"class":605,"line":732},[603,999,1001],{"class":1000},"sHwdD","  \u002F\u002F ...\n",[603,1003,1004,1007,1009,1011,1014,1016,1019,1021,1024,1026,1029,1031,1034,1036,1038,1041,1043],{"class":605,"line":739},[603,1005,1006],{"class":767},"  site",[603,1008,589],{"class":707},[603,1010,708],{"class":707},[603,1012,1013],{"class":767}," url",[603,1015,589],{"class":707},[603,1017,1018],{"class":711}," process",[603,1020,520],{"class":707},[603,1022,1023],{"class":711},"env",[603,1025,520],{"class":707},[603,1027,1028],{"class":711},"TENON_SITE_URL",[603,1030,832],{"class":707},[603,1032,1033],{"class":767}," name",[603,1035,589],{"class":707},[603,1037,721],{"class":707},[603,1039,1040],{"class":612},"My Site",[603,1042,726],{"class":707},[603,1044,844],{"class":707},[603,1046,1047,1050,1052,1054,1057,1059,1061,1063,1065,1067,1070],{"class":605,"line":764},[603,1048,1049],{"class":767},"  auth",[603,1051,589],{"class":707},[603,1053,708],{"class":707},[603,1055,1056],{"class":767}," baseURL",[603,1058,589],{"class":707},[603,1060,1018],{"class":711},[603,1062,520],{"class":707},[603,1064,1023],{"class":711},[603,1066,520],{"class":707},[603,1068,1069],{"class":711},"TENON_CMS_URL ",[603,1071,1072],{"class":707},"},\n",[603,1074,1075,1077,1079],{"class":605,"line":783},[603,1076,953],{"class":707},[603,1078,956],{"class":711},[603,1080,729],{"class":707},[484,1082,1083,1084,589],{},"Then set both in ",[504,1085,1086],{},".env",[534,1088,1090],{"className":596,"code":1089,"filename":1086,"language":599,"meta":540,"style":540},"TENON_SITE_URL=http:\u002F\u002Flocalhost:3000\nTENON_CMS_URL=http:\u002F\u002Flocalhost:3200\n",[504,1091,1092,1101],{"__ignoreMap":540},[603,1093,1094,1096,1098],{"class":605,"line":606},[603,1095,1028],{"class":711},[603,1097,752],{"class":707},[603,1099,1100],{"class":612},"http:\u002F\u002Flocalhost:3000\n",[603,1102,1103,1106,1108],{"class":605,"line":732},[603,1104,1105],{"class":711},"TENON_CMS_URL",[603,1107,752],{"class":707},[603,1109,1110],{"class":612},"http:\u002F\u002Flocalhost:3200\n",[527,1112,1113,1118],{},[530,1114,1115,1117],{},[504,1116,976],{}," is the site. The CMS allows CORS from its origin, and the admin opens permalinks on it.",[530,1119,1120,1122],{},[504,1121,972],{}," is the CMS. Sign-in uses it, and media URLs become absolute on it.",[568,1124,1126],{"id":1125},"start-the-cms","Start the CMS",[484,1128,1129],{},"Start the CMS on port 3200:",[534,1131,1133],{"className":596,"code":1132,"language":599,"meta":540,"style":540},"cd cms\nnpm run dev -- --port 3200\n",[504,1134,1135,1142],{"__ignoreMap":540},[603,1136,1137,1140],{"class":605,"line":606},[603,1138,1139],{"class":755},"cd",[603,1141,619],{"class":612},[603,1143,1144,1146,1149,1152,1155,1158],{"class":605,"line":732},[603,1145,598],{"class":609},[603,1147,1148],{"class":612}," run",[603,1150,1151],{"class":612}," dev",[603,1153,1154],{"class":612}," --",[603,1156,1157],{"class":612}," --port",[603,1159,1161],{"class":1160},"sbssI"," 3200\n",[484,1163,1164,1165,1168],{},"Open ",[504,1166,1167],{},"http:\u002F\u002Flocalhost:3200\u002Fadmin"," and create the first admin. Create a post, give it a cover image and publish it.",[522,1170,1172],{"id":1171},"build-the-site","Build the site",[564,1174,1175,1179,1188,1330,1345,1349,1364,1371,1379,1383,1386,1552,1580,1584,1588,1933,1979,1997,2001,2008,2480,2490,2542,2546,2552,2699,2702,2908],{"level":566},[568,1176,1178],{"id":1177},"create-the-nextjs-app","Create the Next.js app",[484,1180,574,1181,1183,1184,1187],{},[504,1182,577],{},", create a Next.js app in the folder ",[504,1185,1186],{},"site",", and install Tenon in it:",[591,1189,1190,1229,1264,1297],{"sync":593},[534,1191,1193],{"className":596,"code":1192,"filename":598,"language":599,"meta":540,"style":540},"npx create-next-app@latest site --app --ts\ncd site\nnpm install tenoncms\n",[504,1194,1195,1212,1219],{"__ignoreMap":540},[603,1196,1197,1200,1203,1206,1209],{"class":605,"line":606},[603,1198,1199],{"class":609},"npx",[603,1201,1202],{"class":612}," create-next-app@latest",[603,1204,1205],{"class":612}," site",[603,1207,1208],{"class":612}," --app",[603,1210,1211],{"class":612}," --ts\n",[603,1213,1214,1216],{"class":605,"line":732},[603,1215,1139],{"class":755},[603,1217,1218],{"class":612}," site\n",[603,1220,1221,1223,1226],{"class":605,"line":739},[603,1222,598],{"class":609},[603,1224,1225],{"class":612}," install",[603,1227,1228],{"class":612}," tenoncms\n",[534,1230,1232],{"className":596,"code":1231,"filename":623,"language":599,"meta":540,"style":540},"pnpm create next-app site --app --ts\ncd site\npnpm add tenoncms\n",[504,1233,1234,1249,1255],{"__ignoreMap":540},[603,1235,1236,1238,1240,1243,1245,1247],{"class":605,"line":606},[603,1237,623],{"class":609},[603,1239,613],{"class":612},[603,1241,1242],{"class":612}," next-app",[603,1244,1205],{"class":612},[603,1246,1208],{"class":612},[603,1248,1211],{"class":612},[603,1250,1251,1253],{"class":605,"line":732},[603,1252,1139],{"class":755},[603,1254,1218],{"class":612},[603,1256,1257,1259,1262],{"class":605,"line":739},[603,1258,623],{"class":609},[603,1260,1261],{"class":612}," add",[603,1263,1228],{"class":612},[534,1265,1267],{"className":596,"code":1266,"filename":640,"language":599,"meta":540,"style":540},"yarn create next-app site --app --ts\ncd site\nyarn add tenoncms\n",[504,1268,1269,1283,1289],{"__ignoreMap":540},[603,1270,1271,1273,1275,1277,1279,1281],{"class":605,"line":606},[603,1272,640],{"class":609},[603,1274,613],{"class":612},[603,1276,1242],{"class":612},[603,1278,1205],{"class":612},[603,1280,1208],{"class":612},[603,1282,1211],{"class":612},[603,1284,1285,1287],{"class":605,"line":732},[603,1286,1139],{"class":755},[603,1288,1218],{"class":612},[603,1290,1291,1293,1295],{"class":605,"line":739},[603,1292,640],{"class":609},[603,1294,1261],{"class":612},[603,1296,1228],{"class":612},[534,1298,1300],{"className":596,"code":1299,"filename":656,"language":599,"meta":540,"style":540},"bun create next-app site --app --ts\ncd site\nbun add tenoncms\n",[504,1301,1302,1316,1322],{"__ignoreMap":540},[603,1303,1304,1306,1308,1310,1312,1314],{"class":605,"line":606},[603,1305,656],{"class":609},[603,1307,613],{"class":612},[603,1309,1242],{"class":612},[603,1311,1205],{"class":612},[603,1313,1208],{"class":612},[603,1315,1211],{"class":612},[603,1317,1318,1320],{"class":605,"line":732},[603,1319,1139],{"class":755},[603,1321,1218],{"class":612},[603,1323,1324,1326,1328],{"class":605,"line":739},[603,1325,656],{"class":609},[603,1327,1261],{"class":612},[603,1329,1228],{"class":612},[484,1331,1332,1333,1336,1337,1340,1341,1344],{},"The site imports only ",[504,1334,1335],{},"tenoncms\u002Fclient",", ",[504,1338,1339],{},"tenoncms\u002Fpreview"," and ",[504,1342,1343],{},"tenoncms\u002Freact",". No CMS server code ends up in its bundle.",[568,1346,1348],{"id":1347},"set-the-cms-origin","Set the CMS origin",[534,1350,1353],{"className":596,"code":1351,"filename":1352,"language":599,"meta":540,"style":540},"NEXT_PUBLIC_TENON_CMS_URL=http:\u002F\u002Flocalhost:3200\n",".env.local",[504,1354,1355],{"__ignoreMap":540},[603,1356,1357,1360,1362],{"class":605,"line":606},[603,1358,1359],{"class":711},"NEXT_PUBLIC_TENON_CMS_URL",[603,1361,752],{"class":707},[603,1363,1110],{"class":612},[484,1365,1366,1367,1370],{},"The server reads content from this origin, and the browser loads the admin bar from it. It needs the ",[504,1368,1369],{},"NEXT_PUBLIC_"," prefix, because browser code reads it.",[527,1372,1373,1376],{},[530,1374,1375],{},"Give the origin only, without a path or a trailing slash.",[530,1377,1378],{},"Next.js writes the value into the build. Set it before you build.",[568,1380,1382],{"id":1381},"create-the-client","Create the client",[484,1384,1385],{},"Create one client for each page request:",[534,1387,1390],{"className":693,"code":1388,"filename":1389,"language":696,"meta":540,"style":540},"import { headers } from \"next\u002Fheaders\";\nimport { createRequestClient } from \"tenoncms\u002Fclient\";\nimport type cms from \"..\u002F..\u002Fcms\u002Ftenon.config\";\n\nexport async function cmsClient() {\n  return createRequestClient\u003Ctypeof cms>(\n    { headers: await headers() },\n    { baseUrl: process.env.NEXT_PUBLIC_TENON_CMS_URL! },\n  );\n}\n","lib\u002Fcms.ts",[504,1391,1392,1414,1435,1456,1460,1478,1497,1516,1540,1547],{"__ignoreMap":540},[603,1393,1394,1396,1398,1401,1403,1405,1407,1410,1412],{"class":605,"line":606},[603,1395,704],{"class":703},[603,1397,708],{"class":707},[603,1399,1400],{"class":711}," headers",[603,1402,715],{"class":707},[603,1404,718],{"class":703},[603,1406,721],{"class":707},[603,1408,1409],{"class":612},"next\u002Fheaders",[603,1411,726],{"class":707},[603,1413,729],{"class":707},[603,1415,1416,1418,1420,1423,1425,1427,1429,1431,1433],{"class":605,"line":732},[603,1417,704],{"class":703},[603,1419,708],{"class":707},[603,1421,1422],{"class":711}," createRequestClient",[603,1424,715],{"class":707},[603,1426,718],{"class":703},[603,1428,721],{"class":707},[603,1430,1335],{"class":612},[603,1432,726],{"class":707},[603,1434,729],{"class":707},[603,1436,1437,1439,1441,1444,1447,1449,1452,1454],{"class":605,"line":739},[603,1438,704],{"class":703},[603,1440,821],{"class":703},[603,1442,1443],{"class":711}," cms ",[603,1445,1446],{"class":703},"from",[603,1448,721],{"class":707},[603,1450,1451],{"class":612},"..\u002F..\u002Fcms\u002Ftenon.config",[603,1453,726],{"class":707},[603,1455,729],{"class":707},[603,1457,1458],{"class":605,"line":764},[603,1459,736],{"emptyLinePlaceholder":735},[603,1461,1462,1464,1467,1470,1473,1476],{"class":605,"line":783},[603,1463,742],{"class":703},[603,1465,1466],{"class":745}," async",[603,1468,1469],{"class":745}," function",[603,1471,1472],{"class":755}," cmsClient",[603,1474,1475],{"class":707},"()",[603,1477,808],{"class":707},[603,1479,1480,1483,1485,1488,1491,1494],{"class":605,"line":800},[603,1481,1482],{"class":703},"  return",[603,1484,1422],{"class":755},[603,1486,1487],{"class":707},"\u003Ctypeof",[603,1489,1490],{"class":711}," cms",[603,1492,1493],{"class":707},">",[603,1495,1496],{"class":767},"(\n",[603,1498,1499,1502,1504,1506,1509,1511,1514],{"class":605,"line":811},[603,1500,1501],{"class":707},"    {",[603,1503,1400],{"class":767},[603,1505,589],{"class":707},[603,1507,1508],{"class":703}," await",[603,1510,1400],{"class":755},[603,1512,1513],{"class":767},"() ",[603,1515,1072],{"class":707},[603,1517,1518,1520,1523,1525,1527,1529,1531,1533,1535,1538],{"class":605,"line":847},[603,1519,1501],{"class":707},[603,1521,1522],{"class":767}," baseUrl",[603,1524,589],{"class":707},[603,1526,1018],{"class":711},[603,1528,520],{"class":707},[603,1530,1023],{"class":711},[603,1532,520],{"class":707},[603,1534,1359],{"class":711},[603,1536,1537],{"class":707},"!",[603,1539,844],{"class":707},[603,1541,1542,1545],{"class":605,"line":899},[603,1543,1544],{"class":767},"  )",[603,1546,729],{"class":707},[603,1548,1549],{"class":605,"line":921},[603,1550,1551],{"class":707},"}\n",[527,1553,1554,1564,1574],{},[530,1555,1556,1559,1560,1563],{},[504,1557,1558],{},"createRequestClient()"," sends the ",[504,1561,1562],{},"cookie"," header of the page request to the CMS. An editor with the preview cookie reads drafts, everyone else reads published content.",[530,1565,1566,1569,1570,1573],{},[504,1567,1568],{},"headers()"," makes every page that calls ",[504,1571,1572],{},"cmsClient()"," render per request.",[530,1575,1576,1579],{},[504,1577,1578],{},"import type"," puts no CMS code in the site. It types the collections and their fields.",[1581,1582,1583],"caution",{},"A request client belongs to one request. Never keep one in a module variable, or one visitor reads with the cookies of another.",[568,1585,1587],{"id":1586},"list-the-posts","List the posts",[534,1589,1594],{"className":1590,"code":1591,"filename":1592,"language":1593,"meta":540,"style":540},"language-tsx shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import Link from \"next\u002Flink\";\nimport { cmsClient } from \"@\u002Flib\u002Fcms\";\n\nexport default async function Home() {\n  const cms = await cmsClient();\n  const posts = await cms.find(\"posts\", { select: { title: true, slug: true } });\n\n  return (\n    \u003Cmain>\n      \u003Ch1>Posts\u003C\u002Fh1>\n      \u003Cul>\n        {posts.map((post) => (\n          \u003Cli key={post.id}>\n            \u003CLink href={`\u002Fposts\u002F${post.slug}`}>{post.title}\u003C\u002FLink>\n          \u003C\u002Fli>\n        ))}\n      \u003C\u002Ful>\n    \u003C\u002Fmain>\n  );\n}\n","app\u002Fpage.tsx","tsx",[504,1595,1596,1614,1635,1639,1656,1674,1735,1739,1746,1757,1777,1785,1812,1836,1883,1893,1901,1911,1921,1928],{"__ignoreMap":540},[603,1597,1598,1600,1603,1605,1607,1610,1612],{"class":605,"line":606},[603,1599,704],{"class":703},[603,1601,1602],{"class":711}," Link ",[603,1604,1446],{"class":703},[603,1606,721],{"class":707},[603,1608,1609],{"class":612},"next\u002Flink",[603,1611,726],{"class":707},[603,1613,729],{"class":707},[603,1615,1616,1618,1620,1622,1624,1626,1628,1631,1633],{"class":605,"line":732},[603,1617,704],{"class":703},[603,1619,708],{"class":707},[603,1621,1472],{"class":711},[603,1623,715],{"class":707},[603,1625,718],{"class":703},[603,1627,721],{"class":707},[603,1629,1630],{"class":612},"@\u002Flib\u002Fcms",[603,1632,726],{"class":707},[603,1634,729],{"class":707},[603,1636,1637],{"class":605,"line":739},[603,1638,736],{"emptyLinePlaceholder":735},[603,1640,1641,1643,1645,1647,1649,1652,1654],{"class":605,"line":764},[603,1642,742],{"class":703},[603,1644,988],{"class":703},[603,1646,1466],{"class":745},[603,1648,1469],{"class":745},[603,1650,1651],{"class":755}," Home",[603,1653,1475],{"class":707},[603,1655,808],{"class":707},[603,1657,1658,1661,1663,1666,1668,1670,1672],{"class":605,"line":783},[603,1659,1660],{"class":745},"  const",[603,1662,1490],{"class":711},[603,1664,1665],{"class":707}," =",[603,1667,1508],{"class":703},[603,1669,1472],{"class":755},[603,1671,1475],{"class":767},[603,1673,729],{"class":707},[603,1675,1676,1678,1681,1683,1685,1687,1689,1692,1694,1696,1698,1700,1702,1704,1707,1709,1711,1714,1716,1718,1720,1723,1725,1727,1729,1731,1733],{"class":605,"line":800},[603,1677,1660],{"class":745},[603,1679,1680],{"class":711}," posts",[603,1682,1665],{"class":707},[603,1684,1508],{"class":703},[603,1686,1490],{"class":711},[603,1688,520],{"class":707},[603,1690,1691],{"class":755},"find",[603,1693,758],{"class":767},[603,1695,726],{"class":707},[603,1697,674],{"class":612},[603,1699,726],{"class":707},[603,1701,832],{"class":707},[603,1703,708],{"class":707},[603,1705,1706],{"class":767}," select",[603,1708,589],{"class":707},[603,1710,708],{"class":707},[603,1712,1713],{"class":767}," title",[603,1715,589],{"class":707},[603,1717,841],{"class":840},[603,1719,832],{"class":707},[603,1721,1722],{"class":767}," slug",[603,1724,589],{"class":707},[603,1726,841],{"class":840},[603,1728,715],{"class":707},[603,1730,715],{"class":707},[603,1732,956],{"class":767},[603,1734,729],{"class":707},[603,1736,1737],{"class":605,"line":811},[603,1738,736],{"emptyLinePlaceholder":735},[603,1740,1741,1743],{"class":605,"line":847},[603,1742,1482],{"class":703},[603,1744,1745],{"class":767}," (\n",[603,1747,1748,1751,1754],{"class":605,"line":899},[603,1749,1750],{"class":707},"    \u003C",[603,1752,1753],{"class":767},"main",[603,1755,1756],{"class":707},">\n",[603,1758,1759,1762,1765,1767,1770,1773,1775],{"class":605,"line":921},[603,1760,1761],{"class":707},"      \u003C",[603,1763,1764],{"class":767},"h1",[603,1766,1493],{"class":707},[603,1768,1769],{"class":711},"Posts",[603,1771,1772],{"class":707},"\u003C\u002F",[603,1774,1764],{"class":767},[603,1776,1756],{"class":707},[603,1778,1779,1781,1783],{"class":605,"line":944},[603,1780,1761],{"class":707},[603,1782,527],{"class":767},[603,1784,1756],{"class":707},[603,1786,1787,1790,1792,1794,1797,1799,1801,1805,1807,1810],{"class":605,"line":950},[603,1788,1789],{"class":707},"        {",[603,1791,674],{"class":711},[603,1793,520],{"class":707},[603,1795,1796],{"class":755},"map",[603,1798,758],{"class":711},[603,1800,758],{"class":707},[603,1802,1804],{"class":1803},"sHdIc","post",[603,1806,956],{"class":707},[603,1808,1809],{"class":745}," =>",[603,1811,1745],{"class":711},[603,1813,1815,1818,1820,1823,1826,1828,1830,1833],{"class":605,"line":1814},13,[603,1816,1817],{"class":707},"          \u003C",[603,1819,530],{"class":767},[603,1821,1822],{"class":745}," key",[603,1824,1825],{"class":707},"={",[603,1827,1804],{"class":711},[603,1829,520],{"class":707},[603,1831,1832],{"class":711},"id",[603,1834,1835],{"class":707},"}>\n",[603,1837,1839,1842,1844,1847,1849,1852,1855,1858,1860,1862,1864,1867,1870,1872,1874,1876,1879,1881],{"class":605,"line":1838},14,[603,1840,1841],{"class":707},"            \u003C",[603,1843,80],{"class":609},[603,1845,1846],{"class":745}," href",[603,1848,1825],{"class":707},[603,1850,1851],{"class":707},"`",[603,1853,1854],{"class":612},"\u002Fposts\u002F",[603,1856,1857],{"class":707},"${",[603,1859,1804],{"class":711},[603,1861,520],{"class":707},[603,1863,863],{"class":711},[603,1865,1866],{"class":707},"}`",[603,1868,1869],{"class":707},"}>{",[603,1871,1804],{"class":711},[603,1873,520],{"class":707},[603,1875,775],{"class":711},[603,1877,1878],{"class":707},"}\u003C\u002F",[603,1880,80],{"class":609},[603,1882,1756],{"class":707},[603,1884,1886,1889,1891],{"class":605,"line":1885},15,[603,1887,1888],{"class":707},"          \u003C\u002F",[603,1890,530],{"class":767},[603,1892,1756],{"class":707},[603,1894,1896,1899],{"class":605,"line":1895},16,[603,1897,1898],{"class":711},"        ))",[603,1900,1551],{"class":707},[603,1902,1904,1907,1909],{"class":605,"line":1903},17,[603,1905,1906],{"class":707},"      \u003C\u002F",[603,1908,527],{"class":767},[603,1910,1756],{"class":707},[603,1912,1914,1917,1919],{"class":605,"line":1913},18,[603,1915,1916],{"class":707},"    \u003C\u002F",[603,1918,1753],{"class":767},[603,1920,1756],{"class":707},[603,1922,1924,1926],{"class":605,"line":1923},19,[603,1925,1544],{"class":767},[603,1927,729],{"class":707},[603,1929,1931],{"class":605,"line":1930},20,[603,1932,1551],{"class":707},[534,1934,1937],{"className":1590,"code":1935,"filename":1936,"language":1593,"meta":540,"style":540},"export default function Loading() {\n  return \u003Cp>Loading…\u003C\u002Fp>;\n}\n","app\u002Floading.tsx",[504,1938,1939,1954,1975],{"__ignoreMap":540},[603,1940,1941,1943,1945,1947,1950,1952],{"class":605,"line":606},[603,1942,742],{"class":703},[603,1944,988],{"class":703},[603,1946,1469],{"class":745},[603,1948,1949],{"class":755}," Loading",[603,1951,1475],{"class":707},[603,1953,808],{"class":707},[603,1955,1956,1958,1961,1963,1965,1968,1970,1972],{"class":605,"line":732},[603,1957,1482],{"class":703},[603,1959,1960],{"class":707}," \u003C",[603,1962,484],{"class":767},[603,1964,1493],{"class":707},[603,1966,1967],{"class":711},"Loading…",[603,1969,1772],{"class":707},[603,1971,484],{"class":767},[603,1973,1974],{"class":707},">;\n",[603,1976,1977],{"class":605,"line":739},[603,1978,1551],{"class":707},[484,1980,1981,1982,1985,1986,1989,1990,1993,1994,1996],{},"New Next.js apps turn on ",[504,1983,1984],{},"cacheComponents",". A page that reads per request then needs a ",[504,1987,1988],{},"loading.tsx"," in its folder, or ",[504,1991,1992],{},"next build"," fails. Without ",[504,1995,1984],{},", the file is optional.",[568,1998,2000],{"id":1999},"render-a-post","Render a post",[484,2002,2003,2004,2007],{},"Mark each element that shows a field with ",[504,2005,2006],{},"edit()",". The live preview writes unsaved values into these elements:",[534,2009,2012],{"className":1590,"code":2010,"filename":2011,"language":1593,"meta":540,"style":540},"import { notFound } from \"next\u002Fnavigation\";\nimport { edit } from \"tenoncms\u002Fpreview\";\nimport { Image } from \"tenoncms\u002Freact\";\nimport { cmsClient } from \"@\u002Flib\u002Fcms\";\n\nexport default async function Post({ params }: { params: Promise\u003C{ slug: string }> }) {\n  const { slug } = await params;\n  const cms = await cmsClient();\n  const post = await cms.findOne(\"posts\", { where: { slug } });\n  if (!post) notFound();\n\n  return (\n    \u003Cmain>\n      \u003Ch1 data-cms={edit(\"posts\", post.id, \"title\")}>{post.title}\u003C\u002Fh1>\n      \u003CImage\n        image={post.cover}\n        data-cms={edit(\"posts\", post.id, \"cover\")}\n        sizes=\"(min-width: 720px) 720px, 100vw\"\n      \u002F>\n      \u003Cp data-cms={edit(\"posts\", post.id, \"body\")}>{post.body}\u003C\u002Fp>\n    \u003C\u002Fmain>\n  );\n}\n","app\u002Fposts\u002F[slug]\u002Fpage.tsx",[504,2013,2014,2036,2057,2078,2098,2102,2151,2169,2185,2232,2254,2258,2264,2272,2326,2333,2349,2386,2401,2406,2459,2468,2475],{"__ignoreMap":540},[603,2015,2016,2018,2020,2023,2025,2027,2029,2032,2034],{"class":605,"line":606},[603,2017,704],{"class":703},[603,2019,708],{"class":707},[603,2021,2022],{"class":711}," notFound",[603,2024,715],{"class":707},[603,2026,718],{"class":703},[603,2028,721],{"class":707},[603,2030,2031],{"class":612},"next\u002Fnavigation",[603,2033,726],{"class":707},[603,2035,729],{"class":707},[603,2037,2038,2040,2042,2045,2047,2049,2051,2053,2055],{"class":605,"line":732},[603,2039,704],{"class":703},[603,2041,708],{"class":707},[603,2043,2044],{"class":711}," edit",[603,2046,715],{"class":707},[603,2048,718],{"class":703},[603,2050,721],{"class":707},[603,2052,1339],{"class":612},[603,2054,726],{"class":707},[603,2056,729],{"class":707},[603,2058,2059,2061,2063,2066,2068,2070,2072,2074,2076],{"class":605,"line":739},[603,2060,704],{"class":703},[603,2062,708],{"class":707},[603,2064,2065],{"class":711}," Image",[603,2067,715],{"class":707},[603,2069,718],{"class":703},[603,2071,721],{"class":707},[603,2073,1343],{"class":612},[603,2075,726],{"class":707},[603,2077,729],{"class":707},[603,2079,2080,2082,2084,2086,2088,2090,2092,2094,2096],{"class":605,"line":764},[603,2081,704],{"class":703},[603,2083,708],{"class":707},[603,2085,1472],{"class":711},[603,2087,715],{"class":707},[603,2089,718],{"class":703},[603,2091,721],{"class":707},[603,2093,1630],{"class":612},[603,2095,726],{"class":707},[603,2097,729],{"class":707},[603,2099,2100],{"class":605,"line":783},[603,2101,736],{"emptyLinePlaceholder":735},[603,2103,2104,2106,2108,2110,2112,2115,2118,2121,2124,2126,2128,2130,2133,2136,2138,2140,2143,2146,2149],{"class":605,"line":800},[603,2105,742],{"class":703},[603,2107,988],{"class":703},[603,2109,1466],{"class":745},[603,2111,1469],{"class":745},[603,2113,2114],{"class":755}," Post",[603,2116,2117],{"class":707},"({",[603,2119,2120],{"class":1803}," params",[603,2122,2123],{"class":707}," }:",[603,2125,708],{"class":707},[603,2127,2120],{"class":767},[603,2129,589],{"class":707},[603,2131,2132],{"class":609}," Promise",[603,2134,2135],{"class":707},"\u003C{",[603,2137,1722],{"class":767},[603,2139,589],{"class":707},[603,2141,2142],{"class":609}," string",[603,2144,2145],{"class":707}," }>",[603,2147,2148],{"class":707}," })",[603,2150,808],{"class":707},[603,2152,2153,2155,2157,2159,2161,2163,2165,2167],{"class":605,"line":811},[603,2154,1660],{"class":745},[603,2156,708],{"class":707},[603,2158,1722],{"class":711},[603,2160,715],{"class":707},[603,2162,1665],{"class":707},[603,2164,1508],{"class":703},[603,2166,2120],{"class":711},[603,2168,729],{"class":707},[603,2170,2171,2173,2175,2177,2179,2181,2183],{"class":605,"line":847},[603,2172,1660],{"class":745},[603,2174,1490],{"class":711},[603,2176,1665],{"class":707},[603,2178,1508],{"class":703},[603,2180,1472],{"class":755},[603,2182,1475],{"class":767},[603,2184,729],{"class":707},[603,2186,2187,2189,2192,2194,2196,2198,2200,2203,2205,2207,2209,2211,2213,2215,2218,2220,2222,2224,2226,2228,2230],{"class":605,"line":899},[603,2188,1660],{"class":745},[603,2190,2191],{"class":711}," post",[603,2193,1665],{"class":707},[603,2195,1508],{"class":703},[603,2197,1490],{"class":711},[603,2199,520],{"class":707},[603,2201,2202],{"class":755},"findOne",[603,2204,758],{"class":767},[603,2206,726],{"class":707},[603,2208,674],{"class":612},[603,2210,726],{"class":707},[603,2212,832],{"class":707},[603,2214,708],{"class":707},[603,2216,2217],{"class":767}," where",[603,2219,589],{"class":707},[603,2221,708],{"class":707},[603,2223,1722],{"class":711},[603,2225,715],{"class":707},[603,2227,715],{"class":707},[603,2229,956],{"class":767},[603,2231,729],{"class":707},[603,2233,2234,2237,2240,2242,2244,2247,2250,2252],{"class":605,"line":921},[603,2235,2236],{"class":703},"  if",[603,2238,2239],{"class":767}," (",[603,2241,1537],{"class":707},[603,2243,1804],{"class":711},[603,2245,2246],{"class":767},") ",[603,2248,2249],{"class":755},"notFound",[603,2251,1475],{"class":767},[603,2253,729],{"class":707},[603,2255,2256],{"class":605,"line":944},[603,2257,736],{"emptyLinePlaceholder":735},[603,2259,2260,2262],{"class":605,"line":950},[603,2261,1482],{"class":703},[603,2263,1745],{"class":767},[603,2265,2266,2268,2270],{"class":605,"line":1814},[603,2267,1750],{"class":707},[603,2269,1753],{"class":767},[603,2271,1756],{"class":707},[603,2273,2274,2276,2278,2281,2283,2286,2288,2290,2292,2294,2296,2298,2300,2302,2304,2306,2308,2310,2312,2314,2316,2318,2320,2322,2324],{"class":605,"line":1838},[603,2275,1761],{"class":707},[603,2277,1764],{"class":767},[603,2279,2280],{"class":745}," data-cms",[603,2282,1825],{"class":707},[603,2284,2285],{"class":755},"edit",[603,2287,758],{"class":711},[603,2289,726],{"class":707},[603,2291,674],{"class":612},[603,2293,726],{"class":707},[603,2295,832],{"class":707},[603,2297,2191],{"class":711},[603,2299,520],{"class":707},[603,2301,1832],{"class":711},[603,2303,832],{"class":707},[603,2305,721],{"class":707},[603,2307,775],{"class":612},[603,2309,726],{"class":707},[603,2311,956],{"class":711},[603,2313,1869],{"class":707},[603,2315,1804],{"class":711},[603,2317,520],{"class":707},[603,2319,775],{"class":711},[603,2321,1878],{"class":707},[603,2323,1764],{"class":767},[603,2325,1756],{"class":707},[603,2327,2328,2330],{"class":605,"line":1885},[603,2329,1761],{"class":707},[603,2331,2332],{"class":609},"Image\n",[603,2334,2335,2338,2340,2342,2344,2347],{"class":605,"line":1895},[603,2336,2337],{"class":745},"        image",[603,2339,1825],{"class":707},[603,2341,1804],{"class":711},[603,2343,520],{"class":707},[603,2345,2346],{"class":711},"cover",[603,2348,1551],{"class":707},[603,2350,2351,2354,2356,2358,2360,2362,2364,2366,2368,2370,2372,2374,2376,2378,2380,2382,2384],{"class":605,"line":1903},[603,2352,2353],{"class":745},"        data-cms",[603,2355,1825],{"class":707},[603,2357,2285],{"class":755},[603,2359,758],{"class":711},[603,2361,726],{"class":707},[603,2363,674],{"class":612},[603,2365,726],{"class":707},[603,2367,832],{"class":707},[603,2369,2191],{"class":711},[603,2371,520],{"class":707},[603,2373,1832],{"class":711},[603,2375,832],{"class":707},[603,2377,721],{"class":707},[603,2379,2346],{"class":612},[603,2381,726],{"class":707},[603,2383,956],{"class":711},[603,2385,1551],{"class":707},[603,2387,2388,2391,2393,2395,2398],{"class":605,"line":1913},[603,2389,2390],{"class":745},"        sizes",[603,2392,752],{"class":707},[603,2394,726],{"class":707},[603,2396,2397],{"class":612},"(min-width: 720px) 720px, 100vw",[603,2399,2400],{"class":707},"\"\n",[603,2402,2403],{"class":605,"line":1923},[603,2404,2405],{"class":707},"      \u002F>\n",[603,2407,2408,2410,2412,2414,2416,2418,2420,2422,2424,2426,2428,2430,2432,2434,2436,2438,2441,2443,2445,2447,2449,2451,2453,2455,2457],{"class":605,"line":1930},[603,2409,1761],{"class":707},[603,2411,484],{"class":767},[603,2413,2280],{"class":745},[603,2415,1825],{"class":707},[603,2417,2285],{"class":755},[603,2419,758],{"class":711},[603,2421,726],{"class":707},[603,2423,674],{"class":612},[603,2425,726],{"class":707},[603,2427,832],{"class":707},[603,2429,2191],{"class":711},[603,2431,520],{"class":707},[603,2433,1832],{"class":711},[603,2435,832],{"class":707},[603,2437,721],{"class":707},[603,2439,2440],{"class":612},"body",[603,2442,726],{"class":707},[603,2444,956],{"class":711},[603,2446,1869],{"class":707},[603,2448,1804],{"class":711},[603,2450,520],{"class":707},[603,2452,2440],{"class":711},[603,2454,1878],{"class":707},[603,2456,484],{"class":767},[603,2458,1756],{"class":707},[603,2460,2462,2464,2466],{"class":605,"line":2461},21,[603,2463,1916],{"class":707},[603,2465,1753],{"class":767},[603,2467,1756],{"class":707},[603,2469,2471,2473],{"class":605,"line":2470},22,[603,2472,1544],{"class":767},[603,2474,729],{"class":707},[603,2476,2478],{"class":605,"line":2477},23,[603,2479,1551],{"class":707},[484,2481,2482,2483,2485,2486,2489],{},"Copy ",[504,2484,1936],{}," to ",[504,2487,2488],{},"app\u002Fposts\u002F[slug]\u002Floading.tsx",". Next.js wants a loading state in each dynamic folder.",[527,2491,2492,2522,2528],{},[530,2493,2494,2496,2497,2500,2501,1336,2504,1336,2507,1340,2510,2513,2514,2517,2518,2521],{},[504,2495,76],{}," renders an ",[504,2498,2499],{},"\u003Cimg>"," with ",[504,2502,2503],{},"src",[504,2505,2506],{},"width",[504,2508,2509],{},"height",[504,2511,2512],{},"alt",", and ",[504,2515,2516],{},"srcset"," when the CMS has an ",[491,2519,2520],{"href":415},"image provider",". It works in server components.",[530,2523,2524,2525,520],{},"The URLs point to the CMS, like ",[504,2526,2527],{},"http:\u002F\u002Flocalhost:3200\u002F_tenon\u002Fmedia\u002Ffiles\u002Fcover.jpg",[530,2529,2530,2533,2534,2537,2538,2541],{},[504,2531,2532],{},"notFound()"," in streamed content answers ",[504,2535,2536],{},"200"," with a ",[504,2539,2540],{},"noindex"," tag. That is how Next.js streams; it is not a Tenon setting.",[568,2543,2545],{"id":2544},"start-the-preview-runtime","Start the preview runtime",[484,2547,2548,2551],{},[504,2549,2550],{},"preview()"," runs in the browser. Put it in a client component:",[534,2553,2556],{"className":1590,"code":2554,"filename":2555,"language":1593,"meta":540,"style":540},"\"use client\";\n\nimport { useEffect } from \"react\";\nimport { preview } from \"tenoncms\u002Fpreview\";\n\nexport function TenonPreview() {\n  useEffect(() => preview({ admin: `${process.env.NEXT_PUBLIC_TENON_CMS_URL}\u002Fadmin` }), []);\n  return null;\n}\n","app\u002Ftenon-preview.tsx",[504,2557,2558,2569,2573,2595,2616,2620,2633,2688,2695],{"__ignoreMap":540},[603,2559,2560,2562,2565,2567],{"class":605,"line":606},[603,2561,726],{"class":707},[603,2563,2564],{"class":612},"use client",[603,2566,726],{"class":707},[603,2568,729],{"class":707},[603,2570,2571],{"class":605,"line":732},[603,2572,736],{"emptyLinePlaceholder":735},[603,2574,2575,2577,2579,2582,2584,2586,2588,2591,2593],{"class":605,"line":739},[603,2576,704],{"class":703},[603,2578,708],{"class":707},[603,2580,2581],{"class":711}," useEffect",[603,2583,715],{"class":707},[603,2585,718],{"class":703},[603,2587,721],{"class":707},[603,2589,2590],{"class":612},"react",[603,2592,726],{"class":707},[603,2594,729],{"class":707},[603,2596,2597,2599,2601,2604,2606,2608,2610,2612,2614],{"class":605,"line":764},[603,2598,704],{"class":703},[603,2600,708],{"class":707},[603,2602,2603],{"class":711}," preview",[603,2605,715],{"class":707},[603,2607,718],{"class":703},[603,2609,721],{"class":707},[603,2611,1339],{"class":612},[603,2613,726],{"class":707},[603,2615,729],{"class":707},[603,2617,2618],{"class":605,"line":783},[603,2619,736],{"emptyLinePlaceholder":735},[603,2621,2622,2624,2626,2629,2631],{"class":605,"line":800},[603,2623,742],{"class":703},[603,2625,1469],{"class":745},[603,2627,2628],{"class":755}," TenonPreview",[603,2630,1475],{"class":707},[603,2632,808],{"class":707},[603,2634,2635,2638,2640,2642,2644,2646,2648,2651,2654,2656,2659,2662,2664,2666,2668,2670,2672,2675,2677,2679,2681,2683,2686],{"class":605,"line":811},[603,2636,2637],{"class":755},"  useEffect",[603,2639,758],{"class":767},[603,2641,1475],{"class":707},[603,2643,1809],{"class":745},[603,2645,2603],{"class":755},[603,2647,758],{"class":767},[603,2649,2650],{"class":707},"{",[603,2652,2653],{"class":767}," admin",[603,2655,589],{"class":707},[603,2657,2658],{"class":707}," `${",[603,2660,2661],{"class":711},"process",[603,2663,520],{"class":707},[603,2665,1023],{"class":711},[603,2667,520],{"class":707},[603,2669,1359],{"class":711},[603,2671,953],{"class":707},[603,2673,2674],{"class":612},"\u002Fadmin",[603,2676,1851],{"class":707},[603,2678,715],{"class":707},[603,2680,956],{"class":767},[603,2682,832],{"class":707},[603,2684,2685],{"class":767}," [])",[603,2687,729],{"class":707},[603,2689,2690,2692],{"class":605,"line":847},[603,2691,1482],{"class":703},[603,2693,2694],{"class":707}," null;\n",[603,2696,2697],{"class":605,"line":899},[603,2698,1551],{"class":707},[484,2700,2701],{},"Render it once, in the root layout:",[534,2703,2706],{"className":1590,"code":2704,"filename":2705,"language":1593,"meta":540,"style":540},"import type { Metadata } from \"next\";\nimport { TenonPreview } from \".\u002Ftenon-preview\";\n\nexport const metadata: Metadata = { title: \"My Site\" };\n\nexport default function RootLayout({ children }: { children: React.ReactNode }) {\n  return (\n    \u003Chtml lang=\"en\">\n      \u003Cbody>\n        {children}\n        \u003CTenonPreview \u002F>\n      \u003C\u002Fbody>\n    \u003C\u002Fhtml>\n  );\n}\n","app\u002Flayout.tsx",[504,2707,2708,2732,2753,2757,2787,2791,2827,2833,2854,2862,2871,2882,2890,2898,2904],{"__ignoreMap":540},[603,2709,2710,2712,2714,2716,2719,2721,2723,2725,2728,2730],{"class":605,"line":606},[603,2711,704],{"class":703},[603,2713,821],{"class":703},[603,2715,708],{"class":707},[603,2717,2718],{"class":711}," Metadata",[603,2720,715],{"class":707},[603,2722,718],{"class":703},[603,2724,721],{"class":707},[603,2726,2727],{"class":612},"next",[603,2729,726],{"class":707},[603,2731,729],{"class":707},[603,2733,2734,2736,2738,2740,2742,2744,2746,2749,2751],{"class":605,"line":732},[603,2735,704],{"class":703},[603,2737,708],{"class":707},[603,2739,2628],{"class":711},[603,2741,715],{"class":707},[603,2743,718],{"class":703},[603,2745,721],{"class":707},[603,2747,2748],{"class":612},".\u002Ftenon-preview",[603,2750,726],{"class":707},[603,2752,729],{"class":707},[603,2754,2755],{"class":605,"line":739},[603,2756,736],{"emptyLinePlaceholder":735},[603,2758,2759,2761,2763,2766,2768,2770,2772,2774,2776,2778,2780,2782,2784],{"class":605,"line":764},[603,2760,742],{"class":703},[603,2762,746],{"class":745},[603,2764,2765],{"class":711}," metadata",[603,2767,589],{"class":707},[603,2769,2718],{"class":609},[603,2771,1665],{"class":707},[603,2773,708],{"class":707},[603,2775,1713],{"class":767},[603,2777,589],{"class":707},[603,2779,721],{"class":707},[603,2781,1040],{"class":612},[603,2783,726],{"class":707},[603,2785,2786],{"class":707}," };\n",[603,2788,2789],{"class":605,"line":783},[603,2790,736],{"emptyLinePlaceholder":735},[603,2792,2793,2795,2797,2799,2802,2804,2807,2809,2811,2813,2815,2818,2820,2823,2825],{"class":605,"line":800},[603,2794,742],{"class":703},[603,2796,988],{"class":703},[603,2798,1469],{"class":745},[603,2800,2801],{"class":755}," RootLayout",[603,2803,2117],{"class":707},[603,2805,2806],{"class":1803}," children",[603,2808,2123],{"class":707},[603,2810,708],{"class":707},[603,2812,2806],{"class":767},[603,2814,589],{"class":707},[603,2816,2817],{"class":609}," React",[603,2819,520],{"class":707},[603,2821,2822],{"class":609},"ReactNode",[603,2824,2148],{"class":707},[603,2826,808],{"class":707},[603,2828,2829,2831],{"class":605,"line":811},[603,2830,1482],{"class":703},[603,2832,1745],{"class":767},[603,2834,2835,2837,2840,2843,2845,2847,2850,2852],{"class":605,"line":847},[603,2836,1750],{"class":707},[603,2838,2839],{"class":767},"html",[603,2841,2842],{"class":745}," lang",[603,2844,752],{"class":707},[603,2846,726],{"class":707},[603,2848,2849],{"class":612},"en",[603,2851,726],{"class":707},[603,2853,1756],{"class":707},[603,2855,2856,2858,2860],{"class":605,"line":899},[603,2857,1761],{"class":707},[603,2859,2440],{"class":767},[603,2861,1756],{"class":707},[603,2863,2864,2866,2869],{"class":605,"line":921},[603,2865,1789],{"class":707},[603,2867,2868],{"class":711},"children",[603,2870,1551],{"class":707},[603,2872,2873,2876,2879],{"class":605,"line":944},[603,2874,2875],{"class":707},"        \u003C",[603,2877,2878],{"class":609},"TenonPreview",[603,2880,2881],{"class":707}," \u002F>\n",[603,2883,2884,2886,2888],{"class":605,"line":950},[603,2885,1906],{"class":707},[603,2887,2440],{"class":767},[603,2889,1756],{"class":707},[603,2891,2892,2894,2896],{"class":605,"line":1814},[603,2893,1916],{"class":707},[603,2895,2839],{"class":767},[603,2897,1756],{"class":707},[603,2899,2900,2902],{"class":605,"line":1838},[603,2901,1544],{"class":767},[603,2903,729],{"class":707},[603,2905,2906],{"class":605,"line":1885},[603,2907,1551],{"class":707},[527,2909,2910,2920],{},[530,2911,2912,2915,2916,2919],{},[504,2913,2914],{},"admin"," is the full URL of the admin. The live preview trusts only its origin. If the CMS sets another ",[504,2917,2918],{},"admin.path",", change it here too.",[530,2921,2922,2923,2925],{},"Without a session, ",[504,2924,2550],{}," does nothing, and the code of the admin bar does not load.",[522,2927,2929],{"id":2928},"try-it","Try it",[2931,2932,2933,2947,2960,2975],"ol",{},[530,2934,2935,2936,2939,2940,2942,2943,2946],{},"Start the site with ",[504,2937,2938],{},"npm run dev"," in ",[504,2941,1186],{},", and open ",[504,2944,2945],{},"http:\u002F\u002Flocalhost:3000",". It lists the post you published.",[530,2948,2949,2950,2952,2953,2955,2956,2959],{},"Sign in at ",[504,2951,1167],{},", then open ",[504,2954,2945],{}," again. The admin bar shows at the bottom. Two ports on ",[504,2957,2958],{},"localhost"," share cookies, so the site sees your session.",[530,2961,2962,2963,2966,2967,2970,2971,2974],{},"In the admin, open the post, switch it to ",[584,2964,2965],{},"Draft"," and change the body. The admin saves the draft as you type. Switch the admin bar to ",[584,2968,2969],{},"Drafts",": the page shows the draft. ",[584,2972,2973],{},"Published"," shows the live version.",[530,2976,2977,2978,2981],{},"Select ",[584,2979,2980],{},"Edit"," in the admin bar. The admin opens the page in its visual editor. Switch the form to the draft and type: the page follows as you type.",[484,2983,2984,2985,2988],{},"Unsaved values reach only the elements with ",[504,2986,2987],{},"data-cms",". The rest of the page shows the saved content after a reload in the visual editor.",[522,2990,2992],{"id":2991},"go-to-production","Go to production",[484,2994,2995,2996,1340,2999,3002],{},"On real domains, the site and the CMS MUST be two hosts of one parent domain, like ",[504,2997,2998],{},"www.example.com",[504,3000,3001],{},"cms.example.com",". The editor's cookies then need to live on the parent domain:",[534,3004,3006],{"className":693,"code":3005,"filename":968,"language":696,"meta":540,"style":540},"export default defineCms({\n  \u002F\u002F ...\n  site: { url: process.env.TENON_SITE_URL },\n  auth: {\n    baseURL: process.env.TENON_CMS_URL,\n    advanced: { crossSubDomainCookies: { enabled: true, domain: \"example.com\" } },\n  },\n});\n",[504,3007,3008,3020,3024,3049,3057,3076,3117,3121],{"__ignoreMap":540},[603,3009,3010,3012,3014,3016,3018],{"class":605,"line":606},[603,3011,742],{"class":703},[603,3013,988],{"class":703},[603,3015,991],{"class":755},[603,3017,758],{"class":711},[603,3019,761],{"class":707},[603,3021,3022],{"class":605,"line":732},[603,3023,1001],{"class":1000},[603,3025,3026,3028,3030,3032,3034,3036,3038,3040,3042,3044,3047],{"class":605,"line":739},[603,3027,1006],{"class":767},[603,3029,589],{"class":707},[603,3031,708],{"class":707},[603,3033,1013],{"class":767},[603,3035,589],{"class":707},[603,3037,1018],{"class":711},[603,3039,520],{"class":707},[603,3041,1023],{"class":711},[603,3043,520],{"class":707},[603,3045,3046],{"class":711},"TENON_SITE_URL ",[603,3048,1072],{"class":707},[603,3050,3051,3053,3055],{"class":605,"line":764},[603,3052,1049],{"class":767},[603,3054,589],{"class":707},[603,3056,808],{"class":707},[603,3058,3059,3062,3064,3066,3068,3070,3072,3074],{"class":605,"line":783},[603,3060,3061],{"class":767},"    baseURL",[603,3063,589],{"class":707},[603,3065,1018],{"class":711},[603,3067,520],{"class":707},[603,3069,1023],{"class":711},[603,3071,520],{"class":707},[603,3073,1105],{"class":711},[603,3075,780],{"class":707},[603,3077,3078,3081,3083,3085,3088,3090,3092,3095,3097,3099,3101,3104,3106,3108,3111,3113,3115],{"class":605,"line":800},[603,3079,3080],{"class":767},"    advanced",[603,3082,589],{"class":707},[603,3084,708],{"class":707},[603,3086,3087],{"class":767}," crossSubDomainCookies",[603,3089,589],{"class":707},[603,3091,708],{"class":707},[603,3093,3094],{"class":767}," enabled",[603,3096,589],{"class":707},[603,3098,841],{"class":840},[603,3100,832],{"class":707},[603,3102,3103],{"class":767}," domain",[603,3105,589],{"class":707},[603,3107,721],{"class":707},[603,3109,3110],{"class":612},"example.com",[603,3112,726],{"class":707},[603,3114,715],{"class":707},[603,3116,844],{"class":707},[603,3118,3119],{"class":605,"line":811},[603,3120,947],{"class":707},[603,3122,3123,3125,3127],{"class":605,"line":847},[603,3124,953],{"class":707},[603,3126,956],{"class":711},[603,3128,729],{"class":707},[527,3130,3131,3140,3146],{},[530,3132,3133,3134,3136,3137,3139],{},"Deploy the CMS like any standalone project, on ",[491,3135,390],{"href":391}," or ",[491,3138,394],{"href":395},". Deploy the site wherever Next.js runs.",[530,3141,3142,3143,520],{},"Build the site with ",[504,3144,3145],{},"NEXT_PUBLIC_TENON_CMS_URL=https:\u002F\u002Fcms.example.com",[530,3147,3148],{},"Serve both over HTTPS.",[484,3150,3151,3152,3156],{},"The ",[491,3153,3155],{"href":3154},"\u002Fdocs\u002Fcore\u002Fworking-with-content\u002Fheadless#production-checklist","production checklist"," lists every step, and explains what sharing the session cookie means for security.",[522,3158,3160],{"id":3159},"related-resources","Related resources",[527,3162,3163,3171,3176,3181,3190,3203],{},[530,3164,3165,3170],{},[491,3166,3168],{"href":500,"rel":3167},[502],[504,3169,506],{},": the finished code of this recipe.",[530,3172,3173,3175],{},[491,3174,163],{"href":164},": origins, cookies, CORS, writes and limits.",[530,3177,3178,3180],{},[491,3179,376],{"href":377},": the CMS project and its files.",[530,3182,3183,3186,3187,3189],{},[491,3184,3185],{"href":193},"Live preview",": what ",[504,3188,2006],{}," marks and how the visual editor uses it.",[530,3191,3192,3194,3195,1336,3197,1336,3200,3202],{},[491,3193,184],{"href":185},": ",[504,3196,76],{},[504,3198,3199],{},"Richtext",[504,3201,56],{}," and the other React components.",[530,3204,3205,3207],{},[491,3206,303],{"href":304},": build a static site again when an editor publishes.",[3209,3210,3211],"style",{},"html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}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 .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 .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .sfNiH, html code.shiki .sfNiH{--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC}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 .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}html pre.shiki code .sHdIc, html code.shiki .sHdIc{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic}",{"title":540,"searchDepth":732,"depth":732,"links":3213},[3214,3215,3221,3229,3230,3231],{"id":524,"depth":732,"text":525},{"id":561,"depth":732,"text":562,"children":3216},[3217,3218,3219,3220],{"id":570,"depth":739,"text":571},{"id":682,"depth":739,"text":683},{"id":961,"depth":739,"text":962},{"id":1125,"depth":739,"text":1126},{"id":1171,"depth":732,"text":1172,"children":3222},[3223,3224,3225,3226,3227,3228],{"id":1177,"depth":739,"text":1178},{"id":1347,"depth":739,"text":1348},{"id":1381,"depth":739,"text":1382},{"id":1586,"depth":739,"text":1587},{"id":1999,"depth":739,"text":2000},{"id":2544,"depth":739,"text":2545},{"id":2928,"depth":732,"text":2929},{"id":2991,"depth":732,"text":2992},{"id":3159,"depth":732,"text":3160},"A Next.js site that reads from a standalone Tenon CMS, with drafts, the admin bar and the live preview.","md",null,{},{"title":439,"description":3232},"ZLEDUW63qSgQA_ORM_IszgzboaGQSvNp2njqArdysVA",[3239,3241],{"title":435,"path":436,"stem":437,"description":3240,"children":-1},"Package schema, routes and admin pieces for reuse.",{"title":443,"path":444,"stem":445,"description":3242,"children":-1},"Common problems and how to fix them.",1795884705867]