CWA 2 is a prerelease (2.0.0-alpha), heading for a beta. It runs production sites; configuration can still change between releases, always with upgrade notes. View versions and support
Cwa 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, and get back the ones that failed
const failures = await cwa.siteConfig.saveConfig({
    siteName: 'My New Site Name',
    indexable: false
})
// failures: [{ key, error }]

// 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()

// Purge only some tags: the same endpoint with a body never flushes
await cwa.siteConfig.purgeHttpCache({ paths: ['/about-us'], tags: ['/_api/component/titles/0199…'] })

// 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, and Purge this page's cache in a page's settings calls purgeHttpCache() with a body (see Purging One Page). The body takes paths, tags or both. 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 waits for every request and resolves to the keys that failed, as { key, error }[]; an empty array means everything saved. The keys that saved are updated in config and savedSiteConfig even when others fail.

If the config hasn't loaded yet, nothing is sent and every key comes back as a failure. saveConfig doesn't validate values: the site settings form checks a sitemapXml value is valid XML before it saves.

Config Keys

The keys, their types and defaults are listed in Site Config & SEO › Default Settings. Passing any other key to saveConfig() sends an unknown parameter to the API.