The Combined Field is a simple UI extension for Contentful CMS that provides a more enhanced way to deal with text fields that are built with dynamic information. This can be relevant on situations you want a taxonomy and you want to automaticaly define the title based on the parent.
The extension has the following features:
- Generate a dynamic text field based on a pattern defined for each Content Model
- Contentful CMS account with permissions to manage extensions
The UI Extension can be installed manually from the Contentful UI following the below steps:
- Navigate to Settings > Extensions
- Click on "Add extension > Install from Github"
- Use
https://raw.githubusercontent.com/pauloamgomes/contentful-combined-field/master/extension.json
in the url - On the extension settings screen change Hosting to Self-hosted using the url
https://pauloamgomes.github.io/contentful-combined-field/
- Add a new text field to your content model, it can be localized.
- On the Appearance tab ensure that Combined Field is selected
- Provide your token based pattern, the pattern can use the following tokens:
[locale]
- Will replace the token with the node locale[field:your-field-name]
- Will replace the token with the value of the field[field:your-reference-field-name:field-name]
- Will replace the token with the value of field that belongs to the reference.[date:format]
- Will replace the token with the date using the date-fns format (https://date-fns.org/v2.14.0/docs/format)
Assuming your locale is English, your entry title is Category 1
the field value will be: Category 1 (en)
When editing the entry the field is automatically updated with the locale (e.g. (en), (pt))
Assuming you have have a simple content model composed by title and parent (reference to same model type) and you create a new entry with title Apple
and parent pointing to Brands
, your new title will be Brands › Apple
.
When editing the entry the field is automatically updated depending on what we put in title or parent fields.
When visualizing the entries will be easier to understand each entry using the combined field title.
After cloning, install the dependencies
yarn install
To bundle the extension
yarn build
To host the extension for development on http://localhost:1234
yarn start
To install the extension:
contentful extension update --force
Works only with text fields and one level depth references.
Copyright 2020 pauloamgomes under the MIT license.