Write site files
write_site_filesCall get_site_context first. Push NEW files (HTML/CSS/JS/images) into a site's DRAFT. To CHANGE an existing page use patch_site_file instead (find/replace on the current file) — rewriting a whole page from memory drops or duplicates things; overwriting an existing .html needs base_hash from read_site_file. Use this when YOU are writing the code yourself instead of asking sitectrl's AI. Text files go in 'content'; binary files (images/fonts) in 'content_base64'. Max 40 files/call, 2 MB/file. Keep the include on every HTML page (the site's built-in private analytics — publish re-adds it if missing). Use clearly-marked placeholder contact info unless the user provided real details. For working forms, POST to /_sc/form/submit with a hidden _form name field — submissions reach the owner's dashboard + email (never use mailto:). Every HTML file is checked before it's written (DOCTYPE, charset, and any invariant this site has declared) — a file that fails is refused and comes back in 'refused' with what's wrong and the exact fix; other files in the same call still write. Site rules: keep sc-track.js, the data-sc-carry canonical/og:url tags and the sc-badge block; never add noindex or 'Disallow: /' on a site with its own domain. Follow with publish_site to go live.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| slug | Yes | ||
| files | Yes |