menu

Routing

Support the documentation

This documentation was written by volunteers. Please help support our effort:

Help us improve the documentation

Draft

This page is not yet fully completed - we are still working on the content here. Expect some rough edges 🙃

The router makes sure that a requested URI finds the correct controller to handle the request. So we can differenziate between two types of routes:

  • Routes that point to a package controller, where you implemented your own PHP. Learn more about this here.
  • Routes that point to a document node. (see below)

Understanding document node routing 

Neos saves all content in the Content Repository in a tree structure. To map routes to document nodes, each document has a uriPathSegment.

An example, if your document nodes look like this:

Root node
|-- Page 1 (uriPathSegment: 'page_1')
    |-- Subpage 1 (uriPathSegment: 'subpage_1')
    |-- Subpage 2 (uriPathSegment: 'subpage_2')
|-- Page 2 (uriPathSegment: 'page_1')
    |-- Subpage 1 (uriPathSegment: 'subpage_1')
    |-- Subpage 2 (uriPathSegment: 'subpage_2')

The route /page_1 would be matched to the document "Page 1", which will then be rendered.

The route /page_1/subpage_2 will be split based on the slashed. The first part matches the document node "Page 1", the second matches "Subpage 2". So Subpage 2 will be rendered.

Since we have a tree structure you can see that two uriPathSegment: 'subpage_1'. This is ok, since they have a different parent.

The uriPathSegment can be set in the document node inspector.

If you define content dimensions (e.g. languages) they will be the first part of the route. Read more about content dimension routing here.

Background

Under the hood Neos provides a class Neos\Neos\Routing\FrontendNodeRoutePartHandler which matches all document node URIs and rendered the corresponding document node.

So there's actually just one routing mechanism, which you will most likely not need to touch.