Content Types

Every object in Plate consists of a content type with no attributes, apart from some defaults, like title. You can set attributes by adding content fields to a content type. The user will then be able to set values in the created attributes in Plate’s edit mode.

Content Types video tutorial (Dutch):

About Content Types

Plate recognizes two kinds of content types:

Inline elements (Element types)

Editable inline elements with partials as theme files. Represented by the Content Element in the Plate Nested Layout Structure. E.g. images, galleries, editable texts, etc.

Layoutable posts (Post types)

Objects that are approachable via a url. E.g. pages, categories, blog posts, etc. their theme files inherit directly from a theme layout. It has two different templates: index and show. The role of index is that of an overview page, show the detail page. However, index is a single page too, but with the index.plate theme file. This way users can change the same attributes for overview pages as detail pages, like header photos etc. Layoutable content types (post types) have URL’s based on their on their objects’ slugs.

Both content types’ objects can be referenced in the reference content field.

When creating content types you have to provide the following data:

‘Title’ and ‘Plural title’

These are used to define the content type in the edit screens, visible for the end user while adding or editing the objects with this content type.

‘Name for id’ and ‘Plural name for id’

These are used to define the content type inside the templating engine. These have to be parameterized (downcased, underscores instead of spaces). The singular name will be the variable that calls the object, on which you can call attributes. E.g. category.name will return ‘Cats and Dogs’, because you have an object with post type ‘Category’, and it’s name is ‘Cats and Dogs’.

Icon name

This is the icon that is used along with the titles in the edit screens.

Slug (only Post type)

For Post types you have to type in the slug for each language your site is available in. The slug is the word that will be the first part of the url for the post: /:content-type-slug/:object-slug. For example, in the case of the post type Categories: /categories/cats-and-dogs. In this case, categories is the slug for the Categories post type, cats-and-dogs the slug for the post (object with post type ‘Category’).

A site always has a root post type (usually Page) that hides the post type’s slug from the url. That means that / and /page-slug work, and Plate recognizes ‘Page’ as the selected Post type.

Example

Let’s say you want to make a ‘Colored Button’ element content type. You’ll fill out the following data:

Now the end user can create actual Colored Button elements. How these buttons look like is up to you: you’ll probably need to add content fields to them, and have to create a theme file for it in your theme: colored_buttons/_colored_button.plate

Creating Content Types

Fill out the necessary fields (see About Content Types to learn more about the functions of this data).

Default Content Types

Every Plate site must have a bare minimum of content types, so there are a couple of defaults that you cannot edit or delete. You can extend them with extra custom content fields. The following is a list of default content types and their default content fields.

Paragraph

Inline editable text. Default content fields:

image

A single image. Default content fields:

Contact form

Contact form. Default content fields:

Multiple images. Default content fields:

HTML code

Inline HTML code. Default content fields:

Inline menu. Default content fields:

Post

Post type for blog posts. (post type with the name posts. Confusing, we know.) No default content fields.

Page

Post type for regular pages. No default content fields.