Create or modify a custom content type
You create a content type once for each kind of content you want to manage, then add the fields editors will fill in. This page walks through creating one, changing it later, and removing it.
What you need
- The Manage Content Types permission. Without it, Content types does not appear in the sidebar.
- A plan for the fields. Read Content types and fields explained first if you have not already. Developer names and field types are permanent.
Create a content type
- Click Content types in the sidebar, then New content type. (The + next to Content in the sidebar does the same.)
- On the Create tab, enter a Singular label, for example
Blog post. It names one item. - Enter a Plural label, for example
Blog posts. It names the list and the sidebar entry. - Check the Developer name. It fills in from the plural label (here
blog_posts). Use lowercase letters, numbers and single underscores. It is used in templates, in the API and in web addresses, and it cannot be changed later. - Optionally add a Description.
- Set the Default route template, or keep the default
{ContentTypeDeveloperName}/{PrimaryField}. See the table below. - Click Create content type.
You should now see the new type's items page, which is empty. Raytha has created a Title field (the primary field), a Content field and a view called All blog posts. That view is already public, at a web address equal to the developer name (for example /blog_posts).
The default route template
This pattern gives every new item its web address. Click a token under the field to insert it.
| Token | Becomes |
|---|---|
{ContentTypeDeveloperName} | The content type's developer name |
{PrimaryField} | The item's primary field value |
{Id} | The item's unique id |
{CurrentYear} | The year the item was created |
{CurrentMonth} | The month number (1 to 12, with no leading zero) |
The result is made URL-friendly (lowercase, hyphens) and cut to 200 characters. If another page already uses that address, Raytha adds a short code in front. Changing the template later affects only items created afterwards; change an existing item's address in its own settings (see Create or edit a page, post or custom content item).
Important A route template cannot begin with a path Raytha reserves, such as
raythaoraccount/login.
Add fields
- Open the content type's items page and choose Settings then Fields. (You can also use the Fields action on the Content types list.)
- Click New field.
- Enter a Label. The Developer name follows it, and you can overwrite it.
- Choose the Field type. Depending on the type, more settings appear: Choices for Radio, Dropdown and Multiple select; Related content type for relationships; sub-fields for repeaters.
- Optionally add a Description (help text) and tick Required.
- Click Create.
The list shows Label, Developer name, Type and Required for each field. Drag the handle on the left of a row to change the order editors see.
Change an existing field
Click the field in the list. You can change the Label, Description, Required, the Choices and a repeater's sub-fields. The developer name and the field type are locked. Click Save.
Change the content type's settings
- On the items page, choose Settings then Configuration. The page is titled with the plural label followed by settings.
- Edit the Singular label, Plural label, Description, Default route template or Primary field. The primary field must be a Single line text field.
- Click Save.
Move a schema between sites
On the Content types list, Export schema downloads every content type, field and view as one JSON file. On another site, open New content type, switch to the Import schema tab and choose the file. Raytha checks it against the site and shows what it will create and update, with any warnings, before it changes anything. The file contains structure only, never content items.
Delete a content type
- Open Settings then Configuration on the content type.
- In the danger zone at the bottom, click Delete content type and confirm.
Danger This permanently deletes the content type, its fields, all its content items including those in the trash, its views and their public addresses. There is no undo. Export the items to CSV first if you might need them (see Export content items to CSV).
Raytha refuses to delete a content type in two cases: another content type has a relationship field pointing at it ("Remove that field first"), or one of its items or views is the home page ("Set a different home page first").
Gotchas
- You cannot create a content type if the active theme has no web template that new content types may use. The error mentions "default web templates accessible for new content types". Fix it under Themes by ticking Content types created later on a template; see Themes and web templates.
- A deleted field's developer name is gone for good (see Content types and fields explained).
- If a field you created does not show in the list on your site, it is not in the view's columns yet, or your template does not print it.