Content Repository in Neos 8

Content's first choice

Neos 8.x

This page is for Neos 8.x and lower. The behavior changed in the new Event Sourced Content Repository in Neos 9.

#What is the Content Repository?

The Content Repository (CR) stores your content. Imagine a table of contents. Every section is identified by a unique path. The CR works the same. Everything you see in the navigation tree in Neos is a node. You can nest them indefinitely. If you can think of it as a tree, you can build it with Neos.

We use nodes to structure content and save it to the CR. Everything you add into Neos is a node. A page is a node. A heading is a node. A two-column layout is a node. Those nodes can be nested just like headings in a table of contents. Each node has a NodeType, and, depending on this NodeType, can have various properties.

#Why do we have the Content Repository?

We are fond of having reusable content. The only known way to us to enable this, is to separate the actual content, e.g. text, headlines or images, from visual aspects, e.g. styling, composition or even HTML. Neos is built around this idea. The Content Repository is the heart of Neos. It stores the content and makes it available to the Fusion rendering layer.

Using Fusion, you can style and format your content as you wish. Different output formats like HTML and JSON are possible at the same time. The concept of separation enables you to reuse the content indefinitely and independently from different presentational variations.

With Neos you rarely need any plugins. You can build a calendar, blog or a wine catalogue without a single line of PHP. These features use the CR. Getting the three latest blog posts on your homepage is easy. Showing the next event in your app is easy.

#Basic structure

The content in Neos is not stored inside tables of a relational database, but inside a tree-based structure: the so-called Neos Content Repository.

To a certain extent, it is comparable to files in a file-system: They are also structured as a tree, and are identified uniquely by the complete path towards the file.

Note

Internally, the Neos Content Repository currently stores the nodes inside database tables as well, but you do not need to worry about that as you never deal with the database directly. This high-level abstraction helps to decouple the data modelling layer from the data persistence layer.

Each element in this tree is called a Node, and is structured as follows:

  • It has a node name which identifies the node, in the same way a file or folder name identifies an element in your local file system.
  • It has a NodeType which determines which properties a node has. Think of it as the type of a file in your file system.
  • Furthermore, it has properties which store the actual data of the node. The NodeType determines which properties exist for a node. As an example, a text node might have a headline and a text property.
  • Nodes may have sub nodes underneath them.


Take a website with a hierarchical menu structure. Each page is represented by a Node of type Document. However, not only the pages themselves are represented as a tree: Imagine a page has two columns, with different content elements inside each of them. The columns are stored as Nodes of type ContentCollection, and they contain nodes of type text, image, or whatever structure is needed.

This nesting can be done indefinitely: Inside a ContentCollection, there could be another three-column element which again contains ContentCollection nodes with arbitrary content inside.

#Characteristics

#The CR is the Core of Neos.

The Content Repository is the conceptual core of Neos. The content in Neos is not stored inside tables of a relational database, but inside a tree-based structure: the so-called Neos Content Repository. It can store arbitrary content by managing so called nodes that can have custom properties and child nodes.

#Configurable mapping of the 'Content Model'

To implement a content model, you do not have to deal with database migrations.

Instead, a model can be implemented using YAML configuration in the NodeTypes.yaml file. This allows to change existing and create new NodeTypes with a text editor.

#Create the NodeTypes that fit your needs

Content elements are easily configurable and extensible, so that plugins are rarely necessary anymore. The configuration of custom content elements is sufficient.

#Modelling abstraction layer to the database

To a certain extent, the CR is comparable to files in a file-system: They are also structured as a tree, and are identified uniquely by the complete path towards the file.

Internally, the Neos Content Repository (=CR) currently stores the nodes inside database tables as well, but you do not need to worry about that as you never deal with the database directly. This high-level abstraction helps to decouple the data modelling layer from the data persistence layer.

#Advanced guide