Content types and fields explained
A content type is the blueprint for one kind of content. Its fields decide what an editor fills in and what a template can print. This page explains the ideas; Create or modify a custom content type has the click-by-click steps.
Content types and content items
Think of a content type as the column headings of a spreadsheet and each content item as one row. A Posts content type might have the fields Title, Content and Featured Image; every post is one item that fills in those fields.
Create a content type when you will have several items that share the same fields and that you want to list, filter or show on their own pages. For a single designed page (About, Contact) use a site page instead.
Every new content type starts with two fields, Title (Single line text, the primary field) and Content (Wysiwyg), and one view named All <plural label>.
The primary field
Each content type has one primary field. It is the item's name: it is shown in lists, used in search and in the item's default web address, and templates read it as PrimaryField.
- The primary field must be a Single line text field.
- Change which field is primary on the content type's Configuration page, in the Primary field setting.
- You cannot delete the primary field. Point the content type at a different field first.
Field settings that apply to every type
| Setting | What it does |
|---|---|
| Label | The name editors see on the form. You can change it later. |
| Developer name | The identifier used in templates and the API. Lowercase letters, numbers and underscores. It is locked after the field is created, together with the field type. |
| Field type | What kind of data the field holds. Locked after creation. |
| Description | Help text for editors. |
| Required | The field must have a value before the item can be published. A draft can be saved with required fields empty. |
Some developer names are reserved because Raytha uses them for built-in columns: Id, PrimaryField, CreationTime, CreatorUser, LastModificationTime, LastModifierUser, IsDraft, IsPublished, Template and RoutePath. Pick something else if Raytha rejects the name.
The field types
The Field type list offers these 13 types:
| Type | Editors get | Use it for |
|---|---|---|
| Single line text | A one-line text box | Titles, names, short labels, a URL, a phone number. The only type that can be the primary field. |
| Long text | A multi-line plain text box | A summary, an address, notes. No formatting. |
| Wysiwyg | A rich text editor with a toolbar | Article bodies and anything with headings, links, lists and images. |
| Radio | A list where one choice can be picked | A short, always-visible set of options, such as a status. |
| Dropdown | A select menu with one choice | The same as Radio, but for longer lists. |
| Checkbox | One tick box | A yes or no flag, such as Featured. |
| Multiple select | A list of tick boxes, any number can be picked | Tags, categories, amenities. |
| Date | A date box (YYYY-MM-DD) | Event dates, publication dates, deadlines. |
| Number | A number box | Prices, quantities, ratings, sort order. |
| Attachment | A file upload, with a Current file link and a Clear button | Featured images, PDFs, downloads. |
| One to one relationship | A picker with a Search related items box | Linking an item to one item of another content type, such as a post's author. |
| Color | A color picker | A brand color or highlight color that a template can use. |
| Repeater | A list of rows, each with the same sub-fields | A repeating group, such as the questions and answers of a FAQ or the rows of a schedule. |
Choices: Radio, Dropdown and Multiple select
These types need at least one choice. Each choice has a Label (what editors see), a Developer name (what is stored) and a Disabled option. Click Add choice to add one and Remove to drop one. Labels and developer names must be unique within the field. You can edit choices later, so it is safe to start with a few.
Relationships
A One to one relationship field points at one item of another content type. When you create the field you pick the Related content type, and it is fixed from then on. Editors choose the related item with a search box. Two consequences:
- You cannot delete a content type while another content type has a relationship field that points at it. Remove that field first.
- In a template, a relationship field gives you the related item, so you can print its
PrimaryFieldor read its content.
Repeaters
A Repeater holds rows. Each row has the same sub-fields, which you define on the repeater field. Sub-fields can be Single line text, Long text, Wysiwyg, Number, Checkbox, Date, Dropdown, Radio, Color or Attachment. You cannot nest a repeater inside a repeater. Repeater fields cannot be sorted or searched in a view; you can only filter on is empty or is not empty.
Reordering fields
On a content type's Fields page, drag the handle at the left of a row to reorder. The order is the order of the form the editors see.
Deleting a field
On the field's edit page, use the Delete field danger zone. Know these rules first:
- The primary field cannot be deleted.
- A field that a view uses for sorting or filtering cannot be deleted. Raytha lists the views. Remove the sort or filter in each view, then delete the field.
- Deleting removes the field from every view's columns.
- Values already saved in items stay in the stored data, but the field no longer appears on forms.
Warning A deleted field's developer name can never be used again on that content type. Raytha keeps deleted fields internally and rejects a new field with the same developer name: "A previously deleted field has already used that developer name. You must choose another one." If you are unsure, leave the field in place and turn off Required rather than deleting it.
Gotchas
- Developer names and types are permanent. Plan names before you create the field. To change a field's type, create a new field with a new developer name and move the data.
- Required is checked at publish time. If publishing fails, fill in the field it names.
- New fields do not appear in lists automatically. Add them to a view's columns on the view's Columns tab, and print them in your templates.
- The developer name of the content type cannot be changed. It appears in the default web address and in templates.