Documentation
Feedback
Guides
API Reference

Guides
Guides
CMS
Integrations

Content plugin

The Content plugin is a VTEX CLI plugin that allows you to manage your store's content and CMS settings from the terminal. Use this plugin to manage CMS schemas, organize components, and define Content Types

Before you begin

Make sure you have the VTEX CLI installed on your machine.

Installing the plugin

To install the plugin, follow these steps:

  1. Open your terminal and log in to your VTEX account:


    _10
    vtex login {accountName}

    Replace {accountName} with your VTEX account name, for example, vtex login yourstore.

  2. Run the following command to install the plugin:


_10
vtex plugins install @vtex/cli-plugin-content

Default commands

Below is a description of the default commands available in the Content plugin. To view detailed information about each command, click the respective command name.

Command nameDescription
initCreates the CMS folder structure with sample files.
generate-schemaCreates a unified schema file from your store components, Content Types, and the FastStore base schema.
split-componentsSplits sections.json into separate files, one per component.
split-content-typesSplits content-types.json into separate files, one per Content Type, for improved Content Type management.
upload-schemaUploads the unified schema file created by the generate-schema command to the Schema Registry, making it available for use in your store's CMS.

init

Initializes the CMS folder structure in your project with sample files. This command creates the basic directory and sample files to help you start customizing the CMS.

Usage


_10
vtex content init

Options

OptionAliasDescription
--help-hDisplays help information for the command.

🔼 Back

generate-schema

Generates a single schema file for the CMS by combining component schemas, Content Type definitions, and the FastStore base schema. This command merges your custom component schemas with the FastStore base schema to create a complete schema ready to upload.

Usage


_10
vtex content generate-schema [COMPONENT_SCHEMAS_PATH] [CONTENT_TYPES_PATH]

Arguments

ArgumentDefaultDescription
COMPONENT_SCHEMAS_PATHcms/faststore/componentsSpecifies the path to the directory containing all custom component schemas.
CONTENT_TYPES_PATHcms/faststore/pagesSpecifies the path to the directory containing all custom Content Type definitions.

Options

OptionAliasDescription
--help-hDisplays help information for the command.
--out=<path>-oSpecifies the output file path for the generated schema. This option is required to produce an output, and without it, the command will only display a success message but won't save or output the schema. Default value: cms_schema.json.
--local=<path>-lUses a local schema file as the base schema instead of fetching the latest FastStore schema from a remote source.
--base=<schemaId>-bSpecifies a schemaId ($id property in a schema) to be used as a custom base schema instead of FastStore's default.

Examples

Generate a schema with default paths and save to a file:


_10
vtex content generate-schema --out schema.json

Generate a schema using custom directories:


_10
vtex content generate-schema cms/components cms/pages --out custom-schema.json

Generate a schema using a local base schema:


_10
vtex content generate-schema --local ./base-schema.json --out final-schema.json

🔼 Back

split-components

Splits a sections.json file into separate component files. Use this command when migrating component definitions from the legacy Headless CMS to the new CMS to help organize your store components by creating a separate file for each component.

Usage


_10
vtex content split-components

Options

OptionAliasDescription
--help-hDisplays help information for the command.
--input=<path>-iSpecifies the path to the sections.json file to split. Default: cms/faststore/sections.json
--output=<path>-oSpecifies the output directory for component files. Default: cms/faststore/components

Examples

Split components using default paths:


_10
vtex content split-components

Split components with custom input and output paths:


_10
vtex content split-components --input ./cms/sections.json --output ./cms/components

🔼 Back

split-content-types

Splits CMS Content Type definitions from content-types.json into separate files, one per Content Type. Use this command when migrating custom Content Types from the legacy Headless CMS to the new CMS to organize your Content Types into separate files for easier management.

Usage


_10
vtex content split-content-types

Options

OptionAliasDescription
--help-hDisplays help information for the command.
--input=<path>-iSpecifies the path to the content-types.json file to split. Default: cms/faststore/content-types.json
--output=<path>-oSpecifies the output directory for Content Type files. Default: cms/faststore/pages
--sections=<path>-sSpecifies the path to sections.json used to filter components by requiredScopes. Default: cms/faststore/sections.json

Examples

Split Content Types using default paths:


_10
vtex content split-content-types

Split Content Types with custom paths:


_10
vtex content split-content-types --input ./cms/content-types.json --output ./cms/pages --sections ./cms/sections.json

🔼 Back

upload-schema

Uploads a local schema file to the Schema Registry. This command publishes your consolidated CMS schema to the CMS, making it available for use in your store.

Usage


_10
vtex content upload-schema [SCHEMA_PATH]

Arguments

ArgumentDefaultDescription
SCHEMA_PATHschema.jsonSpecifies the path to the schema file to upload.

Options

OptionAliasDescription
--help-hDisplays help information for the command.

Examples

Upload a schema file with the default path:


_10
vtex content upload-schema

Upload a custom schema file:


_10
vtex content upload-schema ./custom-schema.json

🔼 Back

Contributors
1
Photo of the contributor
Was this helpful?
Yes
No
Suggest Edits (GitHub)
Contributors
1
Photo of the contributor
Was this helpful?
Suggest edits (GitHub)
On this page