view Jahia 7.3 Jahia 8

How to call a particular view of a node?

Question

The customer has created a view called shortand he wants to call it as http://127.0.0.1:8080/cms/render/(.......)/my-first-news.short.html
How to call the short view?

Answer

The solution is to create a content template for this view but the main thing is that the system name of this content template should be the same as the view. In other words, the system name of the content template must be equal to "short" in the customer's case. 
However, this is not mandatory to give the same name but you still need to provide the system name of the content template in the URL.

Here is an example

You can create two views:

  1. test (default one)
  2. detail (The detail view)

You can create two content templates

  1. with a system name vuesimple to call the default view: test
  2. with a system name details to call the view: detail

At the runtime, you have to call:

  1. the default view http://localhost:8080/cms/render/default/en/sites/mySite/home/pagecontent/test.vuesimple.html
  2. the detail view http://localhost:8080/cms/render/default/en/sites/mySite/home/pagecontent/test.details.html

You can notice that the URL is based on the content template system name for the two views:

  • default view: test and content template: vuesimple
  • detail view: test and content template: details