updatePage
Update an existing CMS page's content, metadata, or status.
Import
import { updatePage } from '@evershop/evershop/cms/services';
EverShop 2.4.0
In 2.4.0, updatePage is the default export of its module and cms/services re-exports with export *, so this named import is undefined. Use the REST endpoint PATCH /api/pages/:id instead until this is fixed.
Syntax
updatePage(uuid: string, data: PageData, context?: Record<string, any>): Promise<CmsPageRow>
Parameters
uuid — The UUID of the page to update.
data — Page data fields to update. status is required; the other fields are optional:
status— Published status (0,1,'0'or'1'). Required.name— Page titleurl_key— URL slugcontent— Page content (block-editor rows; see createPage)meta_title,meta_description,meta_keywords— SEO fields
When url_key changes, updatePage checks that the new key is free, moves the page's URL rewrite, and records a 302 redirect from the old path to the new one.
context (optional) — Context object passed to hooks.
Examples
import { updatePage } from '@evershop/evershop/cms/services';
// `status` is mandatory on update — updatePage sets `required = ['status']`,
// so omitting it throws "must have required property 'status'".
await updatePage('a1b2c3d4-e5f6-7890-abcd-ef1234567890', {
status: '1',
name: 'Updated About Us',
meta_title: 'About Our Store - Updated'
});
See Also
- createPage — Create a CMS page