In Drupal 8, it is easy to add display/view modes. Let say I created the tech display mode and I set it up for the film content type.

Now, I would like to create a route for it and access it as local task of entity.node.canonical.

How can I achieve this?


In Drupal 8 there are two display modes: view mode and form mode.

You can define the view mode in a route using the _entity_view key.

_entity_view: The value is entity_type.view_mode. Will find an entity in the path and render it in the given view mode. E.g. _entity_view: node.teaser will return the render array of the {node} in teaser mode.

| improve this answer | |

The View Mode Page module does just what you're looking for, creating alternate paths to access different view modes.

Create separate pages for different view modes for a given content type.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.