The CWA is in heavy development
The CWA is still in alpha and not ready for production - some code and implementations are likely to change. If you would like to try out the CWA, please enjoy what we have provided and feel free to provide feedback, or get involved on GitHub.
DraftCwa Api

cwa.siteConfig

Site-wide settings persisted in the API and cached in the Pinia store.

Site-wide settings persisted in the API and cached in the Pinia store.

cwa.siteConfig.config           // SiteConfigParams — reactive, read properties directly (no .value)
cwa.siteConfig.savedSiteConfig  // the server-persisted config (before any unsaved changes)
cwa.siteConfig.isLoading        // boolean

// Load or refresh from the API
await cwa.siteConfig.loadConfig()

// Save changed keys
cwa.siteConfig.saveConfig({
    siteName: 'My New Site Name',
    indexable: false
})

// Drop every cached page (POST /_/rendered_html/purge, admin only)
await cwa.siteConfig.purgePageCache()

// Drop everything cached: API responses and pages (POST /_/http_cache/purge, admin only)
// Rejects with a 501 if the deployment's cache can't be flushed
await cwa.siteConfig.purgeHttpCache()

// Load every public page into the cache, reporting progress (admin only)
const summary = await cwa.siteConfig.warmPageCache(({ completed, total }) => {
    console.log(`${completed} of ${total}`)
})
// summary: { total, warmed, failed: [{ path, status, error? }] }

The Purge page cache, Purge all cached data and Warm page cache buttons in site settings call these methods. See Page Caching for how the warm works, and Purging all cached data for when to use the full purge.

Saving

Only keys whose value differs from savedSiteConfig are sent, one request per key — POST /_/site_config_parameters for a key that has never been set, PATCH /_/site_config_parameters/{key} otherwise. saveConfig returns { totalConfigsChanged } straight away. It does not wait for the requests to finish; cwa.siteConfig.totalRequests.value drops back to 0 when they have.

saveConfig no-ops (returning totalConfigsChanged: 0) if a previous save is still in flight or the config hasn't been loaded yet. A sitemapXml value is validated as XML before anything is sent — an invalid document aborts the whole save.

Config Keys

SiteConfigParams — passing any other key will POST an unknown parameter to the API.

KeyType
siteNamestring
fallbackTitleboolean
concatTitleboolean
canonicalUrlstring
indexableboolean
robotsTextstring
robotsAllowNonSeoCrawlersboolean
robotsAllowAiBotsboolean
robotsRemoveSitemapboolean
sitemapEnabledboolean
sitemapXmlstring
maintenanceModeEnabledboolean