TTWeb Basics 4. Content Settings
Content settings are basically models with a single instance. They’re useful for static content that doesn’t get translated (e.g. phone numbers and email addresses) or for things like third-party IDs or library versions.
Content settings files are stored in _data/
in the jekyll project and may either be .yml or .json files. The files will be user-editable via the CMS if a interface definition is provided. To provide an interface for the data, use a key named __EDITABLE_FIELDS__
with the contents of a standard model definition (see Content Model Definitions )
For example, a settings file named analytics.yml might look like:
google_enabled: true
google_id: ABC123
provider_xyz_enabled: false
provider_xyz_id:
uneditable_value: ABC123
__EDITABLE_FIELDS__:
google_enabled:
type: boolean
label: Use Google Analytics?
google_id:
type: string
label: Google Analytics ID
provider_xyz_enabled:
type: boolean
label: Use Provider XYZ Analytics?
provider_xyz_id:
type: string
label: Provider XYZ ID
You may also store key-value pairs that are not user-editable if you provided an __EDITABLE_FIELDS__
definition but don’t specify the addition key names. In the example above the field ‘uneditable_value’ won’t be editable by the user in the CMS because it is not specified by the definition in __EDITABLE_FIELDS__
. This field will only be editable via github or in local dev.
Making settings live-editable
If you want to display the content from the setting and make it editable, you can wrap it with a span with data-elements. For example
<footer>
<div class='email'>
<span
data-live-edit-settings='hotel_settings'
data-live-edit-settings-field='email'
></span>
</div>
</footer>
This will make that span look like an editable region when a user turns live-edit on. Changes they make will be stored in the file _data/hotel_settings.yml in the field email
More Content-Models tutorials
More TTWeb tutorials
-
TTWeb Basics 1. Introduction to Content Models
Overview of TTWeb Content Models.
-
TTWeb Basices 0. Intro
TTWeb CMS and Site Structure overview
-
TTWeb Basics 2. Content Model Definitions
How to build structured data form interfaces in TTWeb
-
TTWeb Basics 3. Content Model Instances
How to use content models and generate dynamic pages in TTWeb
-
TTWeb Basics 6. Site Menus
How to add and configure editable menus on a site
-
TTWeb Basics 5. Content Regions
Adding user editable content regions
-
TTWeb Basics 8. Redirects
Redirect file contents
-
TTWeb Basics 7. Localization And Internationalization
Editing and generating a site in multiple languages
-
TTWeb Liquid 1. Permalinks and IDs
Use the permalink filter to build URLs so they are formatted correctly and auotmatically update