[{"data":1,"prerenderedAt":2899},["ShallowReactive",2],{"navigation_docs":3,"-docs-core-working-with-content-headless":478,"-docs-core-working-with-content-headless-surround":2894},[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":163,"body":480,"description":2888,"extension":2889,"links":2890,"meta":2891,"navigation":555,"path":164,"seo":2892,"stem":165,"__hash__":2893},"docs\u002Fdocs\u002F1.core\u002F3.working-with-content\u002F5.headless.md",{"type":481,"value":482,"toc":2867},"minimark",[483,493,496,504,650,655,658,681,684,964,977,981,988,1066,1088,1106,1116,1132,1137,1147,1267,1302,1305,1309,1333,1400,1404,1407,1467,1471,1477,1561,1728,1740,1744,1747,1771,1775,1781,1868,1920,1924,1940,1986,1990,1993,2112,2116,2119,2207,2230,2237,2304,2315,2319,2343,2360,2535,2541,2545,2554,2576,2643,2649,2652,2655,2662,2666,2669,2702,2705,2734,2749,2753,2785,2788,2791,2828,2832,2863],[484,485,486,487,492],"warning",{},"Headless \u002F Standalone mode is experimental. Expect gaps and changes. It is being worked on and will be part of a v1 release. See ",[488,489,491],"a",{"href":490},"#limits","Limits",".",[494,495],"hr",{},[497,498,499,500,503],"p",{},"Tenon is built to run inside your site. It also works as a headless CMS: another frontend, an app or a service reads the content over the ",[488,501,502],{"href":160},"HTTP API",". A site on another origin can still show drafts to editors, the admin bar and the live preview. This page explains how to set that up, and what does not work yet.",[505,506,511],"pre",{"className":507,"code":508,"language":509,"meta":510,"style":510},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import { createClient } from \"tenoncms\u002Fclient\";\n\nconst cms = createClient({ baseUrl: \"https:\u002F\u002Fcms.example.com\" });\nconst posts = await cms.find(\"posts\", { limit: 10 });\n","ts","",[512,513,514,550,557,600],"code",{"__ignoreMap":510},[515,516,519,523,527,531,534,537,540,544,547],"span",{"class":517,"line":518},"line",1,[515,520,522],{"class":521},"s7zQu","import",[515,524,526],{"class":525},"sMK4o"," {",[515,528,530],{"class":529},"sTEyZ"," createClient",[515,532,533],{"class":525}," }",[515,535,536],{"class":521}," from",[515,538,539],{"class":525}," \"",[515,541,543],{"class":542},"sfazB","tenoncms\u002Fclient",[515,545,546],{"class":525},"\"",[515,548,549],{"class":525},";\n",[515,551,553],{"class":517,"line":552},2,[515,554,556],{"emptyLinePlaceholder":555},true,"\n",[515,558,560,564,567,570,573,576,579,583,586,588,591,593,595,598],{"class":517,"line":559},3,[515,561,563],{"class":562},"spNyl","const",[515,565,566],{"class":529}," cms ",[515,568,569],{"class":525},"=",[515,571,530],{"class":572},"s2Zo4",[515,574,575],{"class":529},"(",[515,577,578],{"class":525},"{",[515,580,582],{"class":581},"swJcz"," baseUrl",[515,584,585],{"class":525},":",[515,587,539],{"class":525},[515,589,590],{"class":542},"https:\u002F\u002Fcms.example.com",[515,592,546],{"class":525},[515,594,533],{"class":525},[515,596,597],{"class":529},")",[515,599,549],{"class":525},[515,601,603,605,608,610,613,616,618,621,623,625,628,630,633,635,638,640,644,646,648],{"class":517,"line":602},4,[515,604,563],{"class":562},[515,606,607],{"class":529}," posts ",[515,609,569],{"class":525},[515,611,612],{"class":521}," await",[515,614,615],{"class":529}," cms",[515,617,492],{"class":525},[515,619,620],{"class":572},"find",[515,622,575],{"class":529},[515,624,546],{"class":525},[515,626,627],{"class":542},"posts",[515,629,546],{"class":525},[515,631,632],{"class":525},",",[515,634,526],{"class":525},[515,636,637],{"class":581}," limit",[515,639,585],{"class":525},[515,641,643],{"class":642},"sbssI"," 10",[515,645,533],{"class":525},[515,647,597],{"class":529},[515,649,549],{"class":525},[651,652,654],"h2",{"id":653},"two-setups","Two setups",[497,656,657],{},"You can use Tenon headless in two ways:",[659,660,661,669],"ul",{},[662,663,664,668],"li",{},[665,666,667],"strong",{},"Next to your site."," Your Astro, Nuxt or TanStack Start site embeds Tenon as usual. A mobile app, a second site or a script reads from it over HTTP.",[662,670,671,674,675,678,679,492],{},[665,672,673],{},"On its own."," A small Vite app runs only the API and the admin, without pages. Every frontend reads over HTTP. To create one, run ",[512,676,677],{},"npm create tenoncms@latest"," and pick ",[665,680,376],{},[497,682,683],{},"The standalone app has one server entry. It serves the admin page and hands every other request to the CMS:",[505,685,688],{"className":507,"code":686,"filename":687,"language":509,"meta":510,"style":510},"import html from \"#tenon\u002Fadmin-html\";\nimport cms from \".\u002Ftenon.config\";\n\nconst admin = cms.adminPath!;\n\nexport default {\n  fetch(request: Request) {\n    const { pathname } = new URL(request.url);\n    if (pathname === admin || pathname.startsWith(`${admin}\u002F`)) {\n      return new Response(html, { headers: { \"content-type\": \"text\u002Fhtml; charset=utf-8\" } });\n    }\n    return cms.fetch(request);\n  },\n};\n","server.ts",[512,689,690,709,726,730,749,754,766,788,823,874,925,931,952,958],{"__ignoreMap":510},[515,691,692,694,697,700,702,705,707],{"class":517,"line":518},[515,693,522],{"class":521},[515,695,696],{"class":529}," html ",[515,698,699],{"class":521},"from",[515,701,539],{"class":525},[515,703,704],{"class":542},"#tenon\u002Fadmin-html",[515,706,546],{"class":525},[515,708,549],{"class":525},[515,710,711,713,715,717,719,722,724],{"class":517,"line":552},[515,712,522],{"class":521},[515,714,566],{"class":529},[515,716,699],{"class":521},[515,718,539],{"class":525},[515,720,721],{"class":542},".\u002Ftenon.config",[515,723,546],{"class":525},[515,725,549],{"class":525},[515,727,728],{"class":517,"line":559},[515,729,556],{"emptyLinePlaceholder":555},[515,731,732,734,737,739,741,743,746],{"class":517,"line":602},[515,733,563],{"class":562},[515,735,736],{"class":529}," admin ",[515,738,569],{"class":525},[515,740,615],{"class":529},[515,742,492],{"class":525},[515,744,745],{"class":529},"adminPath",[515,747,748],{"class":525},"!;\n",[515,750,752],{"class":517,"line":751},5,[515,753,556],{"emptyLinePlaceholder":555},[515,755,757,760,763],{"class":517,"line":756},6,[515,758,759],{"class":521},"export",[515,761,762],{"class":521}," default",[515,764,765],{"class":525}," {\n",[515,767,769,772,774,778,780,784,786],{"class":517,"line":768},7,[515,770,771],{"class":581},"  fetch",[515,773,575],{"class":525},[515,775,777],{"class":776},"sHdIc","request",[515,779,585],{"class":525},[515,781,783],{"class":782},"sBMFI"," Request",[515,785,597],{"class":525},[515,787,765],{"class":525},[515,789,791,794,796,799,801,804,807,810,812,814,816,819,821],{"class":517,"line":790},8,[515,792,793],{"class":562},"    const",[515,795,526],{"class":525},[515,797,798],{"class":529}," pathname",[515,800,533],{"class":525},[515,802,803],{"class":525}," =",[515,805,806],{"class":525}," new",[515,808,809],{"class":572}," URL",[515,811,575],{"class":581},[515,813,777],{"class":529},[515,815,492],{"class":525},[515,817,818],{"class":529},"url",[515,820,597],{"class":581},[515,822,549],{"class":525},[515,824,826,829,832,835,838,841,844,846,848,851,853,856,859,862,865,868,871],{"class":517,"line":825},9,[515,827,828],{"class":521},"    if",[515,830,831],{"class":581}," (",[515,833,834],{"class":529},"pathname",[515,836,837],{"class":525}," ===",[515,839,840],{"class":529}," admin",[515,842,843],{"class":525}," ||",[515,845,798],{"class":529},[515,847,492],{"class":525},[515,849,850],{"class":572},"startsWith",[515,852,575],{"class":581},[515,854,855],{"class":525},"`${",[515,857,858],{"class":529},"admin",[515,860,861],{"class":525},"}",[515,863,864],{"class":542},"\u002F",[515,866,867],{"class":525},"`",[515,869,870],{"class":581},")) ",[515,872,873],{"class":525},"{\n",[515,875,877,880,882,885,887,890,892,894,897,899,901,903,906,908,910,912,915,917,919,921,923],{"class":517,"line":876},10,[515,878,879],{"class":521},"      return",[515,881,806],{"class":525},[515,883,884],{"class":572}," Response",[515,886,575],{"class":581},[515,888,889],{"class":529},"html",[515,891,632],{"class":525},[515,893,526],{"class":525},[515,895,896],{"class":581}," headers",[515,898,585],{"class":525},[515,900,526],{"class":525},[515,902,539],{"class":525},[515,904,905],{"class":581},"content-type",[515,907,546],{"class":525},[515,909,585],{"class":525},[515,911,539],{"class":525},[515,913,914],{"class":542},"text\u002Fhtml; charset=utf-8",[515,916,546],{"class":525},[515,918,533],{"class":525},[515,920,533],{"class":525},[515,922,597],{"class":581},[515,924,549],{"class":525},[515,926,928],{"class":517,"line":927},11,[515,929,930],{"class":525},"    }\n",[515,932,934,937,939,941,944,946,948,950],{"class":517,"line":933},12,[515,935,936],{"class":521},"    return",[515,938,615],{"class":529},[515,940,492],{"class":525},[515,942,943],{"class":572},"fetch",[515,945,575],{"class":581},[515,947,777],{"class":529},[515,949,597],{"class":581},[515,951,549],{"class":525},[515,953,955],{"class":517,"line":954},13,[515,956,957],{"class":525},"  },\n",[515,959,961],{"class":517,"line":960},14,[515,962,963],{"class":525},"};\n",[497,965,966,969,970,973,974,976],{},[512,967,968],{},"tenonAdmin()"," and Nitro in ",[512,971,972],{},"vite.config.ts"," build the admin and the server. See ",[488,975,376],{"href":377}," for the full project.",[651,978,980],{"id":979},"set-the-origins","Set the origins",[497,982,983,984,987],{},"When the site and the CMS run on different origins, ",[512,985,986],{},"tenon.config.ts"," MUST set both:",[505,989,991],{"className":507,"code":990,"filename":986,"language":509,"meta":510,"style":510},"export default defineCms({\n  \u002F\u002F ...\n  site: { url: \"https:\u002F\u002Fwww.example.com\" },\n  auth: { baseURL: \"https:\u002F\u002Fcms.example.com\" },\n});\n",[512,992,993,1006,1012,1036,1058],{"__ignoreMap":510},[515,994,995,997,999,1002,1004],{"class":517,"line":518},[515,996,759],{"class":521},[515,998,762],{"class":521},[515,1000,1001],{"class":572}," defineCms",[515,1003,575],{"class":529},[515,1005,873],{"class":525},[515,1007,1008],{"class":517,"line":552},[515,1009,1011],{"class":1010},"sHwdD","  \u002F\u002F ...\n",[515,1013,1014,1017,1019,1021,1024,1026,1028,1031,1033],{"class":517,"line":559},[515,1015,1016],{"class":581},"  site",[515,1018,585],{"class":525},[515,1020,526],{"class":525},[515,1022,1023],{"class":581}," url",[515,1025,585],{"class":525},[515,1027,539],{"class":525},[515,1029,1030],{"class":542},"https:\u002F\u002Fwww.example.com",[515,1032,546],{"class":525},[515,1034,1035],{"class":525}," },\n",[515,1037,1038,1041,1043,1045,1048,1050,1052,1054,1056],{"class":517,"line":602},[515,1039,1040],{"class":581},"  auth",[515,1042,585],{"class":525},[515,1044,526],{"class":525},[515,1046,1047],{"class":581}," baseURL",[515,1049,585],{"class":525},[515,1051,539],{"class":525},[515,1053,590],{"class":542},[515,1055,546],{"class":525},[515,1057,1035],{"class":525},[515,1059,1060,1062,1064],{"class":517,"line":751},[515,1061,861],{"class":525},[515,1063,597],{"class":529},[515,1065,549],{"class":525},[659,1067,1068,1082],{},[662,1069,1070,1073,1074,1077,1078,1081],{},[512,1071,1072],{},"site.url"," is the public site. CORS allows its origin, and the sitemap, ",[512,1075,1076],{},"robots.txt"," and the URLs from ",[512,1079,1080],{},"permalink"," use it. The admin opens relative preview URLs on it.",[662,1083,1084,1087],{},[512,1085,1086],{},"auth.baseURL"," is the origin of the CMS, without a path. Sign-in, invites and every link into the admin use it.",[497,1089,1090,1091,1094,1095,1098,1099,1102,1103,492],{},"A ",[488,1092,1093],{"href":377},"standalone"," project from ",[512,1096,1097],{},"npm create tenoncms"," reads both from ",[512,1100,1101],{},"TENON_SITE_URL"," and ",[512,1104,1105],{},"TENON_CMS_URL",[497,1107,1108,1109,1111,1112,1115],{},"With only ",[512,1110,1072],{},", sign-in uses the site's origin. Signing in to the admin then fails with ",[512,1113,1114],{},"INVALID_ORIGIN",", and media URLs stay relative.",[497,1117,1118,1119,1121,1122,1125,1126,1129,1130,492],{},"Set ",[512,1120,1080],{}," on a collection to the URL pattern of the site, like ",[512,1123,1124],{},"\u002Fblog\u002F{slug}",". The sitemap, links in rich text, ",[488,1127,1128],{"href":81},"link fields"," and the admin's preview then point to the site's pages. A collection that the site does not render gets no ",[512,1131,1080],{},[1133,1134,1136],"h3",{"id":1135},"share-the-cookies","Share the cookies",[497,1138,1139,1140,1102,1143,1146],{},"Drafts, the admin bar and the live preview need the editor's cookies on the site. The site and the CMS MUST then be two hosts of one parent domain, like ",[512,1141,1142],{},"www.example.com",[512,1144,1145],{},"cms.example.com",". Put the cookies on the parent domain:",[505,1148,1150],{"className":507,"code":1149,"filename":986,"language":509,"meta":510,"style":510},"export default defineCms({\n  \u002F\u002F ...\n  site: { url: \"https:\u002F\u002Fwww.example.com\" },\n  auth: {\n    baseURL: \"https:\u002F\u002Fcms.example.com\",\n    advanced: { crossSubDomainCookies: { enabled: true, domain: \"example.com\" } },\n  },\n});\n",[512,1151,1152,1164,1168,1188,1196,1212,1255,1259],{"__ignoreMap":510},[515,1153,1154,1156,1158,1160,1162],{"class":517,"line":518},[515,1155,759],{"class":521},[515,1157,762],{"class":521},[515,1159,1001],{"class":572},[515,1161,575],{"class":529},[515,1163,873],{"class":525},[515,1165,1166],{"class":517,"line":552},[515,1167,1011],{"class":1010},[515,1169,1170,1172,1174,1176,1178,1180,1182,1184,1186],{"class":517,"line":559},[515,1171,1016],{"class":581},[515,1173,585],{"class":525},[515,1175,526],{"class":525},[515,1177,1023],{"class":581},[515,1179,585],{"class":525},[515,1181,539],{"class":525},[515,1183,1030],{"class":542},[515,1185,546],{"class":525},[515,1187,1035],{"class":525},[515,1189,1190,1192,1194],{"class":517,"line":602},[515,1191,1040],{"class":581},[515,1193,585],{"class":525},[515,1195,765],{"class":525},[515,1197,1198,1201,1203,1205,1207,1209],{"class":517,"line":751},[515,1199,1200],{"class":581},"    baseURL",[515,1202,585],{"class":525},[515,1204,539],{"class":525},[515,1206,590],{"class":542},[515,1208,546],{"class":525},[515,1210,1211],{"class":525},",\n",[515,1213,1214,1217,1219,1221,1224,1226,1228,1231,1233,1237,1239,1242,1244,1246,1249,1251,1253],{"class":517,"line":756},[515,1215,1216],{"class":581},"    advanced",[515,1218,585],{"class":525},[515,1220,526],{"class":525},[515,1222,1223],{"class":581}," crossSubDomainCookies",[515,1225,585],{"class":525},[515,1227,526],{"class":525},[515,1229,1230],{"class":581}," enabled",[515,1232,585],{"class":525},[515,1234,1236],{"class":1235},"sfNiH"," true",[515,1238,632],{"class":525},[515,1240,1241],{"class":581}," domain",[515,1243,585],{"class":525},[515,1245,539],{"class":525},[515,1247,1248],{"class":542},"example.com",[515,1250,546],{"class":525},[515,1252,533],{"class":525},[515,1254,1035],{"class":525},[515,1256,1257],{"class":517,"line":768},[515,1258,957],{"class":525},[515,1260,1261,1263,1265],{"class":517,"line":790},[515,1262,861],{"class":525},[515,1264,597],{"class":529},[515,1266,549],{"class":525},[659,1268,1269,1275,1281,1288],{},[662,1270,1271,1272,1274],{},"The session cookie, the session hint and the preview cookie then live on ",[512,1273,1248],{},", so the browser sends them to the site too.",[662,1276,1118,1277,1280],{},[512,1278,1279],{},"domain"," yourself. Without it, the cookies stay on the CMS host.",[662,1282,1283,1284,1287],{},"Two ports on ",[512,1285,1286],{},"localhost"," need none of this, because cookies ignore ports.",[662,1289,1290,1291,1294,1295,1297,1298,1301],{},"Serve both over HTTPS. With an ",[512,1292,1293],{},"https"," ",[512,1296,1086],{},", the session cookie is ",[512,1299,1300],{},"Secure",", and the browser sends it only to HTTPS pages.",[484,1303,1304],{},"The shared session cookie is the editor's full session. The site's server, and every other host under the parent domain, receives it and can act as the signed-in editor. Share it only when you control every host under that domain.",[1133,1306,1308],{"id":1307},"allow-more-origins","Allow more origins",[497,1310,1311,1312,1315,1316,1325,1326,1329,1330,1332],{},"To allow more origins, like a staging site, set ",[512,1313,1314],{},"cors",". It takes the options of ",[488,1317,1321,1322],{"href":1318,"rel":1319},"https:\u002F\u002Fhono.dev\u002Fdocs\u002Fmiddleware\u002Fbuiltin\u002Fcors",[1320],"nofollow","Hono's ",[512,1323,1324],{},"cors()"," and replaces the defaults key by key. An ",[512,1327,1328],{},"origin"," replaces ",[512,1331,1072],{},", so list the site too:",[505,1334,1336],{"className":507,"code":1335,"filename":986,"language":509,"meta":510,"style":510},"export default defineCms({\n  \u002F\u002F ...\n  cors: { origin: [\"https:\u002F\u002Fwww.example.com\", \"https:\u002F\u002Fstaging.example.com\"] },\n});\n",[512,1337,1338,1350,1354,1392],{"__ignoreMap":510},[515,1339,1340,1342,1344,1346,1348],{"class":517,"line":518},[515,1341,759],{"class":521},[515,1343,762],{"class":521},[515,1345,1001],{"class":572},[515,1347,575],{"class":529},[515,1349,873],{"class":525},[515,1351,1352],{"class":517,"line":552},[515,1353,1011],{"class":1010},[515,1355,1356,1359,1361,1363,1366,1368,1371,1373,1375,1377,1379,1381,1384,1386,1389],{"class":517,"line":559},[515,1357,1358],{"class":581},"  cors",[515,1360,585],{"class":525},[515,1362,526],{"class":525},[515,1364,1365],{"class":581}," origin",[515,1367,585],{"class":525},[515,1369,1370],{"class":529}," [",[515,1372,546],{"class":525},[515,1374,1030],{"class":542},[515,1376,546],{"class":525},[515,1378,632],{"class":525},[515,1380,539],{"class":525},[515,1382,1383],{"class":542},"https:\u002F\u002Fstaging.example.com",[515,1385,546],{"class":525},[515,1387,1388],{"class":529},"] ",[515,1390,1391],{"class":525},"},\n",[515,1393,1394,1396,1398],{"class":517,"line":602},[515,1395,861],{"class":525},[515,1397,597],{"class":529},[515,1399,549],{"class":525},[651,1401,1403],{"id":1402},"read-content","Read content",[497,1405,1406],{},"How the site reads depends on where its code runs:",[1408,1409,1410,1426],"table",{},[1411,1412,1413],"thead",{},[1414,1415,1416,1420,1423],"tr",{},[1417,1418,1419],"th",{},"Where",[1417,1421,1422],{},"Use",[1417,1424,1425],{},"Reads",[1427,1428,1429,1443,1456],"tbody",{},[1414,1430,1431,1435,1440],{},[1432,1433,1434],"td",{},"A page rendered per request",[1432,1436,1437],{},[512,1438,1439],{},"createRequestClient(request, options)",[1432,1441,1442],{},"Drafts for an editor in preview, else published",[1414,1444,1445,1448,1453],{},[1432,1446,1447],{},"A build or a script",[1432,1449,1450],{},[512,1451,1452],{},"createClient(options)",[1432,1454,1455],{},"Published content",[1414,1457,1458,1461,1465],{},[1432,1459,1460],{},"Browser code",[1432,1462,1463],{},[512,1464,1452],{},[1432,1466,1455],{},[1133,1468,1470],{"id":1469},"on-each-request","On each request",[497,1472,1473,1476],{},[512,1474,1475],{},"createRequestClient()"," reads with the cookies of the page request. Create one for each request:",[505,1478,1481],{"className":507,"code":1479,"filename":1480,"language":509,"meta":510,"style":510},"import { createRequestClient } from \"tenoncms\u002Fclient\";\n\nexport const cmsClient = (request: Request) =>\n  createRequestClient(request, { baseUrl: \"https:\u002F\u002Fcms.example.com\" });\n","src\u002Flib\u002Fcms.ts",[512,1482,1483,1504,1508,1533],{"__ignoreMap":510},[515,1484,1485,1487,1489,1492,1494,1496,1498,1500,1502],{"class":517,"line":518},[515,1486,522],{"class":521},[515,1488,526],{"class":525},[515,1490,1491],{"class":529}," createRequestClient",[515,1493,533],{"class":525},[515,1495,536],{"class":521},[515,1497,539],{"class":525},[515,1499,543],{"class":542},[515,1501,546],{"class":525},[515,1503,549],{"class":525},[515,1505,1506],{"class":517,"line":552},[515,1507,556],{"emptyLinePlaceholder":555},[515,1509,1510,1512,1515,1518,1520,1522,1524,1526,1528,1530],{"class":517,"line":559},[515,1511,759],{"class":521},[515,1513,1514],{"class":562}," const",[515,1516,1517],{"class":529}," cmsClient ",[515,1519,569],{"class":525},[515,1521,831],{"class":525},[515,1523,777],{"class":776},[515,1525,585],{"class":525},[515,1527,783],{"class":782},[515,1529,597],{"class":525},[515,1531,1532],{"class":562}," =>\n",[515,1534,1535,1538,1541,1543,1545,1547,1549,1551,1553,1555,1557,1559],{"class":517,"line":602},[515,1536,1537],{"class":572},"  createRequestClient",[515,1539,1540],{"class":529},"(request",[515,1542,632],{"class":525},[515,1544,526],{"class":525},[515,1546,582],{"class":581},[515,1548,585],{"class":525},[515,1550,539],{"class":525},[515,1552,590],{"class":542},[515,1554,546],{"class":525},[515,1556,533],{"class":525},[515,1558,597],{"class":529},[515,1560,549],{"class":525},[505,1562,1567],{"className":1563,"code":1564,"filename":1565,"language":1566,"meta":510,"style":510},"language-astro shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","---\nimport { cmsClient } from \"..\u002F..\u002Flib\u002Fcms\";\n\nconst post = await cmsClient(Astro.request).findOne(\"posts\", {\n  where: { slug: Astro.params.slug! },\n});\nif (!post) return new Response(\"Not found\", { status: 404 });\n---\n","src\u002Fpages\u002Fposts\u002F[slug].astro","astro",[512,1568,1569,1574,1596,1600,1638,1670,1678,1724],{"__ignoreMap":510},[515,1570,1571],{"class":517,"line":518},[515,1572,1573],{"class":1010},"---\n",[515,1575,1576,1578,1580,1583,1585,1587,1589,1592,1594],{"class":517,"line":552},[515,1577,522],{"class":521},[515,1579,526],{"class":525},[515,1581,1582],{"class":529}," cmsClient",[515,1584,533],{"class":525},[515,1586,536],{"class":521},[515,1588,539],{"class":525},[515,1590,1591],{"class":542},"..\u002F..\u002Flib\u002Fcms",[515,1593,546],{"class":525},[515,1595,549],{"class":525},[515,1597,1598],{"class":517,"line":559},[515,1599,556],{"emptyLinePlaceholder":555},[515,1601,1602,1604,1607,1609,1611,1613,1616,1618,1621,1623,1626,1628,1630,1632,1634,1636],{"class":517,"line":602},[515,1603,563],{"class":562},[515,1605,1606],{"class":529}," post ",[515,1608,569],{"class":525},[515,1610,612],{"class":521},[515,1612,1582],{"class":572},[515,1614,1615],{"class":529},"(Astro",[515,1617,492],{"class":525},[515,1619,1620],{"class":529},"request)",[515,1622,492],{"class":525},[515,1624,1625],{"class":572},"findOne",[515,1627,575],{"class":529},[515,1629,546],{"class":525},[515,1631,627],{"class":542},[515,1633,546],{"class":525},[515,1635,632],{"class":525},[515,1637,765],{"class":525},[515,1639,1640,1643,1645,1647,1650,1652,1655,1657,1660,1662,1665,1668],{"class":517,"line":751},[515,1641,1642],{"class":581},"  where",[515,1644,585],{"class":525},[515,1646,526],{"class":525},[515,1648,1649],{"class":581}," slug",[515,1651,585],{"class":525},[515,1653,1654],{"class":529}," Astro",[515,1656,492],{"class":525},[515,1658,1659],{"class":529},"params",[515,1661,492],{"class":525},[515,1663,1664],{"class":529},"slug",[515,1666,1667],{"class":525},"!",[515,1669,1035],{"class":525},[515,1671,1672,1674,1676],{"class":517,"line":756},[515,1673,861],{"class":525},[515,1675,597],{"class":529},[515,1677,549],{"class":525},[515,1679,1680,1683,1685,1687,1690,1693,1695,1697,1699,1701,1704,1706,1708,1710,1713,1715,1718,1720,1722],{"class":517,"line":768},[515,1681,1682],{"class":521},"if",[515,1684,831],{"class":529},[515,1686,1667],{"class":525},[515,1688,1689],{"class":529},"post) ",[515,1691,1692],{"class":521},"return",[515,1694,806],{"class":525},[515,1696,884],{"class":572},[515,1698,575],{"class":529},[515,1700,546],{"class":525},[515,1702,1703],{"class":542},"Not found",[515,1705,546],{"class":525},[515,1707,632],{"class":525},[515,1709,526],{"class":525},[515,1711,1712],{"class":581}," status",[515,1714,585],{"class":525},[515,1716,1717],{"class":642}," 404",[515,1719,533],{"class":525},[515,1721,597],{"class":529},[515,1723,549],{"class":525},[515,1725,1726],{"class":517,"line":790},[515,1727,1573],{"class":1010},[659,1729,1730,1737],{},[662,1731,1732,1733,1736],{},"It sends the request's ",[512,1734,1735],{},"cookie"," header to the CMS, and to no other origin. No other header travels.",[662,1738,1739],{},"A signed-in editor in preview reads drafts. Everyone else reads published content, as a visitor.",[1741,1742,1743],"caution",{},"A request client belongs to one request. Never share one between requests, or one visitor reads with the cookies of another.",[497,1745,1746],{},"How drafts reach a page:",[1748,1749,1750,1753,1760,1763,1768],"ol",{},[662,1751,1752],{},"The editor signs in at the CMS. The browser keeps the session cookie for the parent domain.",[662,1754,1755,1756,1759],{},"The ",[665,1757,1758],{},"Drafts \u002F Published"," switch of the admin bar, or the admin's visual editor, sets the preview cookie.",[662,1761,1762],{},"The browser sends both cookies with every page request to the site.",[662,1764,1765,1767],{},[512,1766,1475],{}," passes them on to the CMS.",[662,1769,1770],{},"The CMS returns drafts only for a valid session with the preview cookie. Without a session, it returns published content, even with the preview cookie.",[1133,1772,1774],{"id":1773},"at-build-time","At build time",[497,1776,1777,1778,585],{},"A build has no page request, so it reads published content with ",[512,1779,1780],{},"createClient()",[505,1782,1784],{"className":507,"code":1783,"language":509,"meta":510,"style":510},"const posts = await cms.find(\"posts\", {\n  select: { title: true, slug: true, cover: true },\n  limit: 10,\n});\n",[512,1785,1786,1814,1849,1860],{"__ignoreMap":510},[515,1787,1788,1790,1792,1794,1796,1798,1800,1802,1804,1806,1808,1810,1812],{"class":517,"line":518},[515,1789,563],{"class":562},[515,1791,607],{"class":529},[515,1793,569],{"class":525},[515,1795,612],{"class":521},[515,1797,615],{"class":529},[515,1799,492],{"class":525},[515,1801,620],{"class":572},[515,1803,575],{"class":529},[515,1805,546],{"class":525},[515,1807,627],{"class":542},[515,1809,546],{"class":525},[515,1811,632],{"class":525},[515,1813,765],{"class":525},[515,1815,1816,1819,1821,1823,1826,1828,1830,1832,1834,1836,1838,1840,1843,1845,1847],{"class":517,"line":552},[515,1817,1818],{"class":581},"  select",[515,1820,585],{"class":525},[515,1822,526],{"class":525},[515,1824,1825],{"class":581}," title",[515,1827,585],{"class":525},[515,1829,1236],{"class":1235},[515,1831,632],{"class":525},[515,1833,1649],{"class":581},[515,1835,585],{"class":525},[515,1837,1236],{"class":1235},[515,1839,632],{"class":525},[515,1841,1842],{"class":581}," cover",[515,1844,585],{"class":525},[515,1846,1236],{"class":1235},[515,1848,1035],{"class":525},[515,1850,1851,1854,1856,1858],{"class":517,"line":559},[515,1852,1853],{"class":581},"  limit",[515,1855,585],{"class":525},[515,1857,643],{"class":642},[515,1859,1211],{"class":525},[515,1861,1862,1864,1866],{"class":517,"line":602},[515,1863,861],{"class":525},[515,1865,597],{"class":529},[515,1867,549],{"class":525},[659,1869,1870,1873,1888,1899],{},[662,1871,1872],{},"Published content is public, so reads need no API key.",[662,1874,1875,1876,1879,1880,1883,1884,1887],{},"A collection that visitors may not read needs an ",[488,1877,1878],{"href":210},"API key"," with ",[512,1881,1882],{},"read"," on it. Fields with ",[512,1885,1886],{},"private: true"," stay hidden, even from a key.",[662,1889,1890,1891,1894,1895,492],{},"A frontend in another language than JavaScript sends plain HTTP requests: ",[512,1892,1893],{},"GET https:\u002F\u002Fcms.example.com\u002F_tenon\u002Fcollections\u002Fposts?limit=10"," returns JSON. See ",[488,1896,1898],{"href":1897},"\u002Fdocs\u002Fcore\u002Fworking-with-content\u002Fhttp-api-and-client#without-the-client","Without the client",[662,1900,1901,1902,1904,1905,1102,1908,1911,1912,1915,1916,1919],{},"The helpers from ",[512,1903,543],{},", like ",[512,1906,1907],{},"seoHead()",[512,1909,1910],{},"switchTarget()",", work in any JavaScript frontend. ",[512,1913,1914],{},"renderRichtext()"," from ",[512,1917,1918],{},"tenoncms\u002Frichtext"," turns rich text into HTML.",[1133,1921,1923],{"id":1922},"in-the-browser","In the browser",[497,1925,1926,1927,1929,1930,1102,1933,1936,1937,1939],{},"The API answers CORS for the origin of ",[512,1928,1072],{},". Browser code on the site can call the content routes and the routes of the admin bar, with ",[512,1931,1932],{},"GET",[512,1934,1935],{},"POST",", and with ",[512,1938,905],{}," as the only request header.",[659,1941,1942,1952,1955,1972],{},[662,1943,1090,1944,1946,1947,1879,1949,492],{},[512,1945,1780],{}," in the browser sends no cookies, so it reads published content. To send them, pass your own ",[512,1948,943],{},[512,1950,1951],{},"credentials: \"include\"",[662,1953,1954],{},"Sign-in, users, API keys and invites stay closed to other origins.",[662,1956,1957,1960,1961,1964,1965,1968,1969,492],{},[512,1958,1959],{},"cors.allowMethods"," replaces the default ",[512,1962,1963],{},"[\"GET\", \"POST\"]",". List those too when you add ",[512,1966,1967],{},"PUT"," or ",[512,1970,1971],{},"DELETE",[662,1973,1974,1975,1977,1978,1981,1982,1985],{},"For any other route, add Hono's ",[512,1976,1324],{}," yourself as ",[512,1979,1980],{},"publicMiddleware"," of a ",[488,1983,1984],{"href":240},"plugin",". Then you decide what another origin can reach.",[1133,1987,1989],{"id":1988},"types","Types",[497,1991,1992],{},"The client is typed when the frontend can see the type of your CMS instance:",[659,1994,1995,2106],{},[662,1996,1997,2000,2001],{},[665,1998,1999],{},"In the same repository",", import only the type. It puts no CMS code into the site's bundle:",[505,2002,2004],{"className":507,"code":2003,"filename":1480,"language":509,"meta":510,"style":510},"import { createRequestClient } from \"tenoncms\u002Fclient\";\nimport type cms from \"..\u002F..\u002F..\u002Fcms\u002Ftenon.config\";\n\nexport const cmsClient = (request: Request) =>\n  createRequestClient\u003Ctypeof cms>(request, { baseUrl: \"https:\u002F\u002Fcms.example.com\" });\n",[512,2005,2006,2026,2046,2050,2072],{"__ignoreMap":510},[515,2007,2008,2010,2012,2014,2016,2018,2020,2022,2024],{"class":517,"line":518},[515,2009,522],{"class":521},[515,2011,526],{"class":525},[515,2013,1491],{"class":529},[515,2015,533],{"class":525},[515,2017,536],{"class":521},[515,2019,539],{"class":525},[515,2021,543],{"class":542},[515,2023,546],{"class":525},[515,2025,549],{"class":525},[515,2027,2028,2030,2033,2035,2037,2039,2042,2044],{"class":517,"line":552},[515,2029,522],{"class":521},[515,2031,2032],{"class":521}," type",[515,2034,566],{"class":529},[515,2036,699],{"class":521},[515,2038,539],{"class":525},[515,2040,2041],{"class":542},"..\u002F..\u002F..\u002Fcms\u002Ftenon.config",[515,2043,546],{"class":525},[515,2045,549],{"class":525},[515,2047,2048],{"class":517,"line":559},[515,2049,556],{"emptyLinePlaceholder":555},[515,2051,2052,2054,2056,2058,2060,2062,2064,2066,2068,2070],{"class":517,"line":602},[515,2053,759],{"class":521},[515,2055,1514],{"class":562},[515,2057,1517],{"class":529},[515,2059,569],{"class":525},[515,2061,831],{"class":525},[515,2063,777],{"class":776},[515,2065,585],{"class":525},[515,2067,783],{"class":782},[515,2069,597],{"class":525},[515,2071,1532],{"class":562},[515,2073,2074,2076,2079,2081,2084,2086,2088,2090,2092,2094,2096,2098,2100,2102,2104],{"class":517,"line":751},[515,2075,1537],{"class":572},[515,2077,2078],{"class":525},"\u003Ctypeof",[515,2080,615],{"class":529},[515,2082,2083],{"class":525},">",[515,2085,1540],{"class":529},[515,2087,632],{"class":525},[515,2089,526],{"class":525},[515,2091,582],{"class":581},[515,2093,585],{"class":525},[515,2095,539],{"class":525},[515,2097,590],{"class":542},[515,2099,546],{"class":525},[515,2101,533],{"class":525},[515,2103,597],{"class":529},[515,2105,549],{"class":525},[662,2107,2108,2111],{},[665,2109,2110],{},"In another repository",", the client has no schema. Collection names are plain strings, and documents are loosely typed.",[651,2113,2115],{"id":2114},"admin-bar-and-live-preview","Admin bar and live preview",[497,2117,2118],{},"Start the preview runtime on every page of the site, with the full URL of the admin:",[505,2120,2123],{"className":1563,"code":2121,"filename":2122,"language":1566,"meta":510,"style":510},"\u003Cscript>\n  import { preview } from \"tenoncms\u002Fpreview\";\n\n  preview({ admin: \"https:\u002F\u002Fcms.example.com\u002Fadmin\", morph: true });\n\u003C\u002Fscript>\n","src\u002Fcomponents\u002FLayout.astro",[512,2124,2125,2136,2159,2163,2198],{"__ignoreMap":510},[515,2126,2127,2130,2133],{"class":517,"line":518},[515,2128,2129],{"class":525},"\u003C",[515,2131,2132],{"class":581},"script",[515,2134,2135],{"class":525},">\n",[515,2137,2138,2141,2143,2146,2148,2150,2152,2155,2157],{"class":517,"line":552},[515,2139,2140],{"class":521},"  import",[515,2142,526],{"class":525},[515,2144,2145],{"class":529}," preview",[515,2147,533],{"class":525},[515,2149,536],{"class":521},[515,2151,539],{"class":525},[515,2153,2154],{"class":542},"tenoncms\u002Fpreview",[515,2156,546],{"class":525},[515,2158,549],{"class":525},[515,2160,2161],{"class":517,"line":559},[515,2162,556],{"emptyLinePlaceholder":555},[515,2164,2165,2168,2170,2172,2174,2176,2178,2181,2183,2185,2188,2190,2192,2194,2196],{"class":517,"line":602},[515,2166,2167],{"class":572},"  preview",[515,2169,575],{"class":529},[515,2171,578],{"class":525},[515,2173,840],{"class":581},[515,2175,585],{"class":525},[515,2177,539],{"class":525},[515,2179,2180],{"class":542},"https:\u002F\u002Fcms.example.com\u002Fadmin",[515,2182,546],{"class":525},[515,2184,632],{"class":525},[515,2186,2187],{"class":581}," morph",[515,2189,585],{"class":525},[515,2191,1236],{"class":1235},[515,2193,533],{"class":525},[515,2195,597],{"class":529},[515,2197,549],{"class":525},[515,2199,2200,2203,2205],{"class":517,"line":751},[515,2201,2202],{"class":525},"\u003C\u002F",[515,2204,2132],{"class":581},[515,2206,2135],{"class":525},[659,2208,2209,2219,2225],{},[662,2210,2211,2212,2214,2215,2218],{},"The live preview trusts only the origin of ",[512,2213,858],{},". The admin bar calls the API on that origin, with the CMS's cookies. If you change ",[512,2216,2217],{},"admin.path",", change it here too.",[662,2220,2221,2224],{},[512,2222,2223],{},"morph: true"," renders the page again from the server after each draft save, so content that is not marked updates too.",[662,2226,2227,2229],{},[512,2228,2154],{}," needs no Tenon adapter. Any bundler builds it.",[497,2231,2232,2233,2236],{},"Mark what a field renders with ",[512,2234,2235],{},"edit()",", like on a site with an adapter:",[505,2238,2240],{"className":1563,"code":2239,"language":1566,"meta":510,"style":510},"\u003Ch1 data-cms={edit(\"posts\", post.id, \"title\")}>{post.title}\u003C\u002Fh1>\n",[512,2241,2242],{"__ignoreMap":510},[515,2243,2244,2246,2249,2252,2255,2258,2260,2262,2264,2266,2268,2271,2273,2276,2278,2280,2283,2285,2287,2290,2293,2295,2297,2300,2302],{"class":517,"line":518},[515,2245,2129],{"class":525},[515,2247,2248],{"class":581},"h1",[515,2250,2251],{"class":562}," data-cms",[515,2253,2254],{"class":525},"={",[515,2256,2257],{"class":572},"edit",[515,2259,575],{"class":529},[515,2261,546],{"class":525},[515,2263,627],{"class":542},[515,2265,546],{"class":525},[515,2267,632],{"class":525},[515,2269,2270],{"class":529}," post",[515,2272,492],{"class":525},[515,2274,2275],{"class":529},"id",[515,2277,632],{"class":525},[515,2279,539],{"class":525},[515,2281,2282],{"class":542},"title",[515,2284,546],{"class":525},[515,2286,597],{"class":529},[515,2288,2289],{"class":525},"}>{",[515,2291,2292],{"class":529},"post",[515,2294,492],{"class":525},[515,2296,2282],{"class":529},[515,2298,2299],{"class":525},"}\u003C\u002F",[515,2301,2248],{"class":581},[515,2303,2135],{"class":525},[497,2305,2306,2307,2310,2311,492],{},"The visual editor lists the marked documents under ",[665,2308,2309],{},"On this page",", and the live preview writes unsaved values into the marked elements. See ",[488,2312,2314],{"href":2313},"\u002Fdocs\u002Fcore\u002Fbuilding-your-site\u002Flive-preview#mark-the-elements","Mark the elements",[651,2316,2318],{"id":2317},"images-and-files","Images and files",[497,2320,2321,2322,1102,2324,2326,2327,2330,2331,2334,2335,2338,2339,2342],{},"When ",[512,2323,1072],{},[512,2325,1086],{}," are set to different origins, reads return media URLs absolute on the CMS, like ",[512,2328,2329],{},"https:\u002F\u002Fcms.example.com\u002F_tenon\u002Fmedia\u002F…",". This covers ",[512,2332,2333],{},"src",", every entry of ",[512,2336,2337],{},"srcset"," and images in rich text. URLs that are already absolute, from ",[512,2340,2341],{},"publicUrl"," or a hosted image provider, stay as they are.",[497,2344,2345,1915,2348,2351,2352,2355,2356,2359],{},[512,2346,2347],{},"imageAttrs()",[512,2349,2350],{},"tenoncms\u002Fcomponents"," turns an image into the attributes of an ",[512,2353,2354],{},"\u003Cimg>",". With ",[512,2357,2358],{},"data-cms",", the live preview also swaps the image:",[505,2361,2363],{"className":1563,"code":2362,"language":1566,"meta":510,"style":510},"---\nimport { imageAttrs } from \"tenoncms\u002Fcomponents\";\nimport { edit } from \"tenoncms\u002Fpreview\";\n\nconst hero = imageAttrs(post.hero, {\n  \"data-cms\": edit(\"posts\", post.id, \"hero\"),\n  sizes: \"(min-width: 720px) 720px, 100vw\",\n});\n---\n\n{hero && \u003Cimg {...hero} \u002F>}\n",[512,2364,2365,2369,2390,2411,2415,2438,2479,2495,2503,2507,2511],{"__ignoreMap":510},[515,2366,2367],{"class":517,"line":518},[515,2368,1573],{"class":1010},[515,2370,2371,2373,2375,2378,2380,2382,2384,2386,2388],{"class":517,"line":552},[515,2372,522],{"class":521},[515,2374,526],{"class":525},[515,2376,2377],{"class":529}," imageAttrs",[515,2379,533],{"class":525},[515,2381,536],{"class":521},[515,2383,539],{"class":525},[515,2385,2350],{"class":542},[515,2387,546],{"class":525},[515,2389,549],{"class":525},[515,2391,2392,2394,2396,2399,2401,2403,2405,2407,2409],{"class":517,"line":559},[515,2393,522],{"class":521},[515,2395,526],{"class":525},[515,2397,2398],{"class":529}," edit",[515,2400,533],{"class":525},[515,2402,536],{"class":521},[515,2404,539],{"class":525},[515,2406,2154],{"class":542},[515,2408,546],{"class":525},[515,2410,549],{"class":525},[515,2412,2413],{"class":517,"line":602},[515,2414,556],{"emptyLinePlaceholder":555},[515,2416,2417,2419,2422,2424,2426,2429,2431,2434,2436],{"class":517,"line":751},[515,2418,563],{"class":562},[515,2420,2421],{"class":529}," hero ",[515,2423,569],{"class":525},[515,2425,2377],{"class":572},[515,2427,2428],{"class":529},"(post",[515,2430,492],{"class":525},[515,2432,2433],{"class":529},"hero",[515,2435,632],{"class":525},[515,2437,765],{"class":525},[515,2439,2440,2443,2445,2447,2449,2451,2453,2455,2457,2459,2461,2463,2465,2467,2469,2471,2473,2475,2477],{"class":517,"line":756},[515,2441,2442],{"class":525},"  \"",[515,2444,2358],{"class":581},[515,2446,546],{"class":525},[515,2448,585],{"class":525},[515,2450,2398],{"class":572},[515,2452,575],{"class":529},[515,2454,546],{"class":525},[515,2456,627],{"class":542},[515,2458,546],{"class":525},[515,2460,632],{"class":525},[515,2462,2270],{"class":529},[515,2464,492],{"class":525},[515,2466,2275],{"class":529},[515,2468,632],{"class":525},[515,2470,539],{"class":525},[515,2472,2433],{"class":542},[515,2474,546],{"class":525},[515,2476,597],{"class":529},[515,2478,1211],{"class":525},[515,2480,2481,2484,2486,2488,2491,2493],{"class":517,"line":768},[515,2482,2483],{"class":581},"  sizes",[515,2485,585],{"class":525},[515,2487,539],{"class":525},[515,2489,2490],{"class":542},"(min-width: 720px) 720px, 100vw",[515,2492,546],{"class":525},[515,2494,1211],{"class":525},[515,2496,2497,2499,2501],{"class":517,"line":790},[515,2498,861],{"class":525},[515,2500,597],{"class":529},[515,2502,549],{"class":525},[515,2504,2505],{"class":517,"line":825},[515,2506,1573],{"class":1010},[515,2508,2509],{"class":517,"line":876},[515,2510,556],{"emptyLinePlaceholder":555},[515,2512,2513,2515,2518,2521,2524,2527,2530,2532],{"class":517,"line":927},[515,2514,578],{"class":525},[515,2516,2517],{"class":529},"hero ",[515,2519,2520],{"class":525},"&&",[515,2522,2523],{"class":525}," \u003C",[515,2525,2526],{"class":581},"img",[515,2528,2529],{"class":525}," {...",[515,2531,2433],{"class":529},[515,2533,2534],{"class":525},"} \u002F>}\n",[497,2536,2537,2538,2540],{},"See ",[488,2539,116],{"href":117}," for storage and image providers.",[651,2542,2544],{"id":2543},"write-content","Write content",[497,2546,2547,2548,1102,2551,492],{},"A request client writes as the signed-in editor, with the editor's access rules. Writes with a JSON body work, like ",[512,2549,2550],{},"create()",[512,2552,2553],{},"update()",[497,2555,2556,2557,2560,2561,1102,2564,2567,2568,2571,2572,2575],{},"Writes without a JSON body, like ",[512,2558,2559],{},"publish()",", ",[512,2562,2563],{},"delete()",[512,2565,2566],{},"media.upload()",", answer ",[512,2569,2570],{},"403"," from a server. The CMS's CSRF check wants an ",[512,2573,2574],{},"Origin"," header, and a server sends none. Use a client with an API key for those, on the frontend's server:",[505,2577,2579],{"className":507,"code":2578,"filename":1480,"language":509,"meta":510,"style":510},"export const writer = createClient({\n  baseUrl: \"https:\u002F\u002Fcms.example.com\",\n  apiKey: process.env.TENON_API_KEY,\n});\n",[512,2580,2581,2598,2613,2635],{"__ignoreMap":510},[515,2582,2583,2585,2587,2590,2592,2594,2596],{"class":517,"line":518},[515,2584,759],{"class":521},[515,2586,1514],{"class":562},[515,2588,2589],{"class":529}," writer ",[515,2591,569],{"class":525},[515,2593,530],{"class":572},[515,2595,575],{"class":529},[515,2597,873],{"class":525},[515,2599,2600,2603,2605,2607,2609,2611],{"class":517,"line":552},[515,2601,2602],{"class":581},"  baseUrl",[515,2604,585],{"class":525},[515,2606,539],{"class":525},[515,2608,590],{"class":542},[515,2610,546],{"class":525},[515,2612,1211],{"class":525},[515,2614,2615,2618,2620,2623,2625,2628,2630,2633],{"class":517,"line":559},[515,2616,2617],{"class":581},"  apiKey",[515,2619,585],{"class":525},[515,2621,2622],{"class":529}," process",[515,2624,492],{"class":525},[515,2626,2627],{"class":529},"env",[515,2629,492],{"class":525},[515,2631,2632],{"class":529},"TENON_API_KEY",[515,2634,1211],{"class":525},[515,2636,2637,2639,2641],{"class":517,"line":602},[515,2638,861],{"class":525},[515,2640,597],{"class":529},[515,2642,549],{"class":525},[497,2644,2645,2646,2648],{},"A client with a key acts as the key, also for reads. A key needs ",[512,2647,1882],{}," on every collection and global it reads, even on published content. Keep a client without a key for reads.",[484,2650,2651],{},"An API key MUST stay on the server. Never send it to a browser.",[651,2653,303],{"id":2654},"rebuild-on-publish",[497,2656,2657,2658,2661],{},"A static frontend shows the content of its last build. A ",[488,2659,2660],{"href":304},"webhook"," tells your host to build again when an editor publishes.",[651,2663,2665],{"id":2664},"the-example","The example",[497,2667,2668],{},"The repository has a full headless setup in two examples:",[659,2670,2671,2686],{},[662,2672,2673,2680,2681,1102,2683,2685],{},[488,2674,2677],{"href":2675,"rel":2676},"https:\u002F\u002Fgithub.com\u002FSuddenDev\u002FTenonCMS\u002Ftree\u002Fmain\u002Fexamples\u002Fstandalone",[1320],[512,2678,2679],{},"examples\u002Fstandalone"," is the CMS, on port 3200. It reads ",[512,2682,1101],{},[512,2684,1105],{}," from the environment.",[662,2687,2688,2695,2696,2560,2698,1102,2700,492],{},[488,2689,2692],{"href":2690,"rel":2691},"https:\u002F\u002Fgithub.com\u002FSuddenDev\u002FTenonCMS\u002Ftree\u002Fmain\u002Fexamples\u002Fheadless-site",[1320],[512,2693,2694],{},"examples\u002Fheadless-site"," is an Astro site on port 4324, without the Tenon integration. It imports only ",[512,2697,543],{},[512,2699,2154],{},[512,2701,2350],{},[497,2703,2704],{},"Run both from the root of the repository:",[505,2706,2710],{"className":2707,"code":2708,"language":2709,"meta":510,"style":510},"language-sh shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","cp -n examples\u002Fstandalone\u002F.env.example examples\u002Fstandalone\u002F.env\npnpm dev:headless\n","sh",[512,2711,2712,2726],{"__ignoreMap":510},[515,2713,2714,2717,2720,2723],{"class":517,"line":518},[515,2715,2716],{"class":782},"cp",[515,2718,2719],{"class":542}," -n",[515,2721,2722],{"class":542}," examples\u002Fstandalone\u002F.env.example",[515,2724,2725],{"class":542}," examples\u002Fstandalone\u002F.env\n",[515,2727,2728,2731],{"class":517,"line":552},[515,2729,2730],{"class":782},"pnpm",[515,2732,2733],{"class":542}," dev:headless\n",[497,2735,2736,2737,2740,2741,2744,2745,2748],{},"Open ",[512,2738,2739],{},"http:\u002F\u002Flocalhost:3200\u002Fadmin",", create the first admin and publish a post. Then open ",[512,2742,2743],{},"http:\u002F\u002Flocalhost:4324",": the admin bar shows, and ",[665,2746,2747],{},"Edit"," opens the page in the visual editor.",[651,2750,2752],{"id":2751},"production-checklist","Production checklist",[659,2754,2755,2762,2770,2779,2782],{},[662,2756,2757,2758,1102,2760,492],{},"Serve the site and the CMS from one parent domain, like ",[512,2759,1142],{},[512,2761,1145],{},[662,2763,1118,2764,2766,2767,2769],{},[512,2765,1072],{}," to the site and ",[512,2768,1086],{}," to the CMS.",[662,2771,1118,2772,2775,2776,2778],{},[512,2773,2774],{},"crossSubDomainCookies",", with ",[512,2777,1279],{}," set to the parent domain.",[662,2780,2781],{},"Serve both over HTTPS.",[662,2783,2784],{},"Build the site with the CMS origin, without a path or a trailing slash. A build writes it into the browser code.",[651,2786,491],{"id":2787},"limits",[497,2789,2790],{},"Tenon is a proof of concept, and the headless setup has gaps:",[659,2792,2793,2799,2816,2822],{},[662,2794,2795,2798],{},[665,2796,2797],{},"One parent domain."," Drafts, the admin bar and the live preview need shared cookies. Unrelated domains do not work, because there is no token flow.",[662,2800,2801,2804,2805,2808,2809,1915,2812,2815],{},[665,2802,2803],{},"Admin bar items with browser code"," are skipped on a site without a Tenon adapter, like an ",[512,2806,2807],{},"onClick"," or a ",[512,2810,2811],{},"mount",[512,2813,2814],{},"clientRef()",". Links and menus still show.",[662,2817,2818,2821],{},[665,2819,2820],{},"No drafts at build time."," A statically built site reads published content only. Use a page that renders per request for the preview.",[662,2823,2824,2827],{},[665,2825,2826],{},"No generated types."," A frontend in another repository gets an untyped client.",[651,2829,2831],{"id":2830},"related-resources","Related resources",[659,2833,2834,2840,2846,2852,2857],{},[662,2835,2836,2839],{},[488,2837,2838],{"href":160},"HTTP API and client",": the client, its options and the routes.",[662,2841,2842,2845],{},[488,2843,2844],{"href":193},"Live preview",": mark elements and follow unsaved changes.",[662,2847,2848,2851],{},[488,2849,2850],{"href":210},"API keys",": create keys and set what they may do.",[662,2853,2854,2856],{},[488,2855,376],{"href":377},": create and deploy a standalone project.",[662,2858,2859,2862],{},[488,2860,2861],{"href":440},"Build a headless site with Next.js",": a Next.js site with drafts, the admin bar and the live preview.",[2864,2865,2866],"style",{},"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 .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}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 .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}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 .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}html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}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}",{"title":510,"searchDepth":552,"depth":552,"links":2868},[2869,2870,2874,2880,2881,2882,2883,2884,2885,2886,2887],{"id":653,"depth":552,"text":654},{"id":979,"depth":552,"text":980,"children":2871},[2872,2873],{"id":1135,"depth":559,"text":1136},{"id":1307,"depth":559,"text":1308},{"id":1402,"depth":552,"text":1403,"children":2875},[2876,2877,2878,2879],{"id":1469,"depth":559,"text":1470},{"id":1773,"depth":559,"text":1774},{"id":1922,"depth":559,"text":1923},{"id":1988,"depth":559,"text":1989},{"id":2114,"depth":552,"text":2115},{"id":2317,"depth":552,"text":2318},{"id":2543,"depth":552,"text":2544},{"id":2654,"depth":552,"text":303},{"id":2664,"depth":552,"text":2665},{"id":2751,"depth":552,"text":2752},{"id":2787,"depth":552,"text":491},{"id":2830,"depth":552,"text":2831},"Use Tenon from a site on another origin, an app or a service, or run it without a site.","md",null,{},{"title":163,"description":2888},"pmal2Sc4XZ7od68qLDWtLALxg6zDRCHlDOsgToVkPpY",[2895,2897],{"title":159,"path":160,"stem":161,"description":2896,"children":-1},"Read and write content from the browser or another service.",{"title":167,"path":168,"stem":169,"description":2898,"children":-1},"Content in several languages, with URLs and fallbacks.",1795884677491]