Skill: Update Site
Write a new draft version of one of your organization's sites. Files you don't send are carried forward, and nothing goes live until a person publishes the draft.
Update Site writes a new draft version of a site your organization owns. The live site doesn’t change; a person publishes the draft from the site’s page in Sites.
Parameters
The Web Builder sends every parameter on every call.
| Parameter | Type | Description |
|---|---|---|
site_name | string | The site, as List Sites reports its site_name |
fetch_current | boolean | false writes a new draft. true reads the current source instead and writes nothing; the Web Builder uses Read Site to read. Anything other than a boolean is refused |
html | string or null | The new index.html. Required and not empty when writing; null when reading |
css | string or null | The new stylesheet. "" or null keeps the previous version’s stylesheet; it doesn’t delete it |
js | string or null | The new script. "" or null keeps the previous version’s script |
pages | array or null | Extra pages to add or change, each { filename, html }. null keeps the previous version’s pages. A page you don’t list is kept. Filenames follow the rule in Create Site |
How a draft is built
- The skill reads the site’s newest draft, so consecutive changes build on each other rather than each starting from the live version.
- It writes the files you sent as a new version, numbered one above the newest.
- Every file you didn’t send, including images and fonts, is copied forward from the version before.
Update Site can add and replace pages but not remove or rename them; Edit Site does that. A version can hold images and fonts of up to 5 MB each and 25 MB in total.
Response
| Field | Description |
|---|---|
success | true |
mode | update |
url | The site’s address. It keeps serving the live version until a person publishes |
site_name, username | The site and its organization’s slug |
files | The files the new draft holds |
version | The new draft’s version number |
live_version | The version visitors see now |
published | Always false |
warning, syntax_errors, missing_files | As in Create Site |
With fetch_current: true, the response is the same as Read Site’s.
When it refuses
| Situation | Result |
|---|---|
No site with that site_name in the organization | “not found or you do not have permission to modify it” |
| The site is archived | An error saying to restore it from the Sites page first |
| Another change landed on the draft after this call read it | Nothing is saved. Read the site again and re-apply the change |
| An image or font over 5 MB, or more than 25 MB of them in the version | Nothing is changed |
Related skills: Read Site | Edit Site | Preview Site | Create Site