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

.contentType.yaml

contentTypes

Content item

.contentItem.yaml

contentItems/<ContentTypeId> for content items with a null locale.

contentItems/<localeId>/<ContentTypeId> (for content items with a specific locale)

Media item

.media.yaml

media/<First character of MediaItemId>/<MediaItemId>

Taxonomy

.taxonomy.yaml

taxonomies

Locale

.locale.yaml

locales

The working folder structure is as follows:

RequestResponse

[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:

  1. Initialize your working folder. This creates the JSON schemas for the supported resource types.

  2. 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.

Do you have some feedback for us?

If you have suggestions for improving this article,