0

I have setup multiple new view modes for a specific node. Full,Teaser,New Teaser,Custom Display.

Is there a way to view the same node with different URLS for the different view modes. Please let me know if i need to explain further.

Hopefully this makes some kind of sense.

2 Answers 2

2

If you would be okay with having a parameter in the url control your view mode then you can add this code to your custom module using hook_entity_view_mode_alter().

For example:

http://www.yoursite.com?view_mode=Full

http://www.yoursite.com?view_mode=Teaser

.....

/**
 * Implements hook_entity_view_mode_alter().
 */
function my_module_entity_view_mode_alter(&$view_mode, $context) {
  // If there is a view_mode parameter in the url change the view mode to it.
  if (isset($_GET['view_mode'])) {
    $view_mode = $_GET['view_mode'];
  }
}
0

You can do this with View Mode Page

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

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.

Or you can use Panels also.

Or a custom module could do this as well but no sense in reinventing the wheel :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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