View mode page - Drupal 8 configuration screen

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

Drupal 9/10:

  • Requirements

  • Configuration

    On the configuration page you can add as many path patterns as you desire, path patterns are based on the regular entity url's/aliases.

    For instance, if you want to show the teaser at a specific URL.

    1. Go to your drupal admin -> "Configuration" -> "Search and metadata" -> "Entity view mode path".
    2. Here you can add a path pattern like /%/summary and select the view_mode teaser.
    • If you have a content page which regular entity url/alias is "/my/great/page".
    • You can now visit "/my/great/page/summary" which will render the teaser of that page.

    The module configuration is exportable like you would expect.

7.x Branch:

  • On the manage display page for a given content type, you can assign patterns for view modes so that they will become a page at the given path. For instance, if you want to show the teaser at a specific URL, you could do node/%/teaser. If you also use Display Suite or other modules that allow you to create new view modes, you can use these modes to display one or more fields from a node at a separate URL.

    This module also includes basic Features module integration. This allows you to selectively export your settings in a feature.

    Restrictions: currently, the node path must be contained in the URL. This means view mode pages must follow the form [node path/node alias]/[view mode url]. These pages are added via hook_menu. Multiple wildcard characters can be used.

  • How to add a view mode page

    1. Create a content type
    2. Configure a view mode. If you are using Display Suite, or another means of adding view modes, you may need to add a new one.
    3. Go to the "manage display" tab for your content type.
    4. In the "View mode pages" tab, enter your URL pattern for the view mode page.
    5. Save the content type. You may also need to clear the Drupal cache, but the page should be available!
  • Some tricks

    Initially, this module was going to display a single field from a node on a page. The view mode example is much more flexible as it allows for multi-field pages.

    Additionally, if you are using something like Display Suite, you can add blocks from Views or other sources to your display allowing you to customize the view mode pages even more.

  • Entity Support (v2.0)

    The original VMP module was written to support nodes. There is now a release that has added entity support. Please check the entity support issue for more information about changes to the API and functions provided by this module.

  • API/Hooks (v1.2)

    Recently added some API/hooks for this module that may allow for more control of the output of the view mode page. Also included some that tie into times when patterns are deleted/added. See the development version (may have to checkout from git).

Supporting organizations: 
Original development
Development and maintenance

Project information

Releases