User Guides

Content Configuration

The content configuration defines the structure of your websites content. Your content is configured using the content.yaml config file, normally this file is placed in the default config directory i.e. /config/default/content.yaml.

In LexasCMS, content is split into two distinct types, sections and collections.


Sections

This section outlines how to define a section in LexasCMS, for a description of what sections are and how to interact with them, see the Sections section of the documentation.

Defining a Section

A simple section definition would look some like the example below:

sections:
  Services:
    fields:
      - { name: "heading", type: "text", title: "Page Heading" }
      - { name: "banner", type: "image", widths: [1140], title: "Page Banner" }
      - { name: "copy", type: "html", title: "Page Copy" }

This defines a section called Services with three content types, a text field for the page heading, an image field for the page banner and finally a HTML editor for the pages main content.

If you logged into the admin panel at this point, there would now be a section called Services listed under the 'Content' section.

Available Options

Sections have a number of configurable options available in the config file, see the table below for a detailed list of the available options.

Option Data Type Description
display string How the sections name should be displayed in the sidebar of the admin panel. For example, if you had defined an 'AboutUs' section, you could use this option to have the sidebar display 'About Us' instead. Defaults to the key of the section.
meta boolean Should the meta fields be displayed for this section? Defaults to false.
fields array The array of content fields to be included in this section.

Collections

This section outlines how to define a collection in LexasCMS, for a description of what collections are and how to interact with them, see the Collections section of the documentation.

Defining a Collection

The following example defines the definition of a service collection item. This collection item could then be consumed by a section in order to create multiple 'services'.

collections:
  service:
    fields:
      - { name: "name", type: "text", title: "Service Name" }
      - { name: "description", type: "html", title: "Service Description" }

Consuming a Collection

Taking the 'Sections' example above, you could now add the 'services' collection into the 'Services' section content definition as follows:

sections:
  Services:
    fields:
      - { name: "heading", type: "text", title: "Page Heading" }
      - { name: "banner", type: "image", widths: [1140], title: "Page Banner" }
      - { name: "copy", type: "html", title: "Page Copy" }
      - { name: "services": type: "collection", definition: "service", title: "Services" }

This would then allow you to create a collection of multiple services to be displayed on your website.

Available Options

Collections have a number of configurable options available in the config file, see the table below for a detailed list of the available options.

Option Data Type Description
meta boolean Should the meta fields be displayed for this collection? Defaults to false.
slug boolean Should the slug field be displayed for this collection? Defaults to false.
fields array The array of content fields to be included in this collection.

Available Content Types

For a list of all of the built in content types, please see the Content Types section of the documentation.