Setting up the Headless CMS (legacy)
Set up and sync Headless CMS (legacy) files so you can add custom Sections to FastStore's native Content Types.
3 min read
Set up the CMS folder so editors can manage native FastStore pages and custom Sections in the VTEX Admin.
FastStore v2 and v3 don't support custom Content Types. Use the Content Types provided by@faststore/core. For informational or other custom pages, use the native Landing Page Content Type.
What you'll accomplish
By the end of this guide, you will have:
- Created the CMS folder structure in your project
- Created a file for custom Section definitions
- Synced the native Content Types and your Section definitions with Headless CMS (legacy)
- Verified the native Content Types in the Headless CMS interface
Before you begin
This guide assumes you are starting without CMS-related files. If your project already includes
cms/faststore/sections.json, use the existing file instead of replacing it.Instructions
Step 1: Creating the CMS folder
- Open the terminal and change to the root directory of your FastStore project.
- Create a new folder named
cmsat the root of your FastStore project and a subfolder namedfaststoreinside thecmsfolder. Run the following command to create them:
macOS and Linux
Windows
_10mkdir -p cms/faststore
- Create
sections.jsoninsidecms/faststore:
macOS and Linux
Windows
_10echo "[]" > cms/faststore/sections.json
The
sections.json file contains the content schemas for custom frontend Sections that editors can add to compatible native Content Types.- Run
yarn devto enable the FastStore CLI watch mode. The CLI monitors your project and merges your custom Sections with the default CMS definitions from@faststore/core.
Step 2: Syncing the CMS definitions
-
Open another terminal and log in to your VTEX account.
-
Create or select a development workspace:
_10vtex use {workspace}
Use a development workspace to test your Section definitions before syncing them with the VTEXmasterworkspace.
-
Change to the root directory of your FastStore project.
-
Sync the CMS definitions with the Headless CMS (legacy) app:
_10yarn cms-sync
The command syncs the native Content Types from
@faststore/core and the custom Sections in your project. Once the synchronization finishes, the terminal displays CMS synced successfully....If you have@vtex/cli-plugin-cms@1.0.7installed, you can use the{builderName}argument to synchronize a specific builder:vtex cms:sync {builderName}.
Step 3: Checking the native Content Types
- Access the VTEX Admin using the workspace you created in Step 2 - Syncing the CMS definitions by navigating to the following path:
https://{workspace}--{account}.myvtex.com/admin. Make sure to replace{workspace}with the designated workspace name and{account}with your VTEX account. - Go to Storefront > Headless CMS.
- Click Create document.
The menu displays FastStore's native Content Types, such as Landing Page, Product Page, and Product List Page. Custom Sections become available after you define them with scopes that match these Content Types.
Next step
Learn how to structure Sections for native Content Types.