Create resources
You can create resources by adding a YAML file to the working folder. Be sure to follow the naming conventions shown in the following table and the directory structure shown in the example.
Resource type |
File extension |
Path |
---|---|---|
Content type |
|
|
Content item |
|
|
Media item |
|
|
Taxonomy |
|
|
Locale |
|
|
The working folder structure is as follows:
[working folder]
├── contentTypes
│ ├── Blog.contentType.yaml
│ └── Article.contentType.yaml
├── contentItems
│ └── Blog
│ └── Post1.contentItem.yaml
│ └── en-GB
│ └── Post1.contentItem.yaml
├── media
│ ├── .registry.yaml
│ └── M
│ └── MyMediaItem
│ ├── MyMediaItem.media.yaml
│ └── MyMediaItem.jpeg
├── taxonomies
│ ├── Color.taxonomy.yaml
├── locales
│ ├── en-GB.locale.yaml
To edit YAML files in Visual Studio Code:
-
Initialize your working folder. This creates the JSON schemas for the supported resource types.
-
Install the YAML extension for Visual Studio Code. The JSON schemas automatically apply to the resource YAML files based on their file extension. As you type, the schemas provide validation and auto-completion for many commonly-used properties.
Content resources
Content resources that do not have a locale, either because localization is not used or because the locale value is not selected, are represented in the contentItem/<contentTypeId>
folder.
When content items do have a locale, they are represented in a specific locale folder, for example contentItem/<contentTypeId>/<locale>
.
Media resources
A media resource consists of two files:
-
A
.yaml
file containing metadata, such as the ID, name, and description of the media resource. -
The actual media file (for example, an image) associated with the media resource.
When you pull a media item, it is recorded in media/.registry.yaml
alongside a hash of the associated media file. This hash is used to determine whether the file has changed, requiring it to be uploaded to the Content Hub ONE tenant.