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.

ParameterTypeDescription
site_namestringThe site, as List Sites reports its site_name
fetch_currentbooleanfalse 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
htmlstring or nullThe new index.html. Required and not empty when writing; null when reading
cssstring or nullThe new stylesheet. "" or null keeps the previous version’s stylesheet; it doesn’t delete it
jsstring or nullThe new script. "" or null keeps the previous version’s script
pagesarray or nullExtra 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

  1. The skill reads the site’s newest draft, so consecutive changes build on each other rather than each starting from the live version.
  2. It writes the files you sent as a new version, numbered one above the newest.
  3. 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

FieldDescription
successtrue
modeupdate
urlThe site’s address. It keeps serving the live version until a person publishes
site_name, usernameThe site and its organization’s slug
filesThe files the new draft holds
versionThe new draft’s version number
live_versionThe version visitors see now
publishedAlways false
warning, syntax_errors, missing_filesAs in Create Site

With fetch_current: true, the response is the same as Read Site’s.

When it refuses

SituationResult
No site with that site_name in the organization“not found or you do not have permission to modify it”
The site is archivedAn error saying to restore it from the Sites page first
Another change landed on the draft after this call read itNothing 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 versionNothing is changed

Related skills: Read Site | Edit Site | Preview Site | Create Site