Skip to content
EnglishFrançais

View

In Jahia, a view is the code that produces, from a content item held in the repository, the HTML the visitor receives. It decides how an article, an offer or an event appears on screen, which properties are shown, in what order and with what formatting. Combined with a content item, it produces a component, the HTML fragment the visitor sees.

Definition and how it works

A view separates content from its presentation. The same content item can be shown in several ways, such as a short card in a list, a full version on its own page or a box in the sidebar of another page. Editors enter the content once. A visual redesign means rewriting this display code, not re-entering content.

This code is written by developers and shipped in a module, in JSP (Java web pages) or, in a JavaScript module (an option since Jahia 8.2), in React with JSX or TSX. The template organizes the page framework, while the view renders each content item placed inside it. Depending on the views deployed for the content type, several renderings can be offered for the same content item.

Academy documentation: Jahia JavaScript modules and their template and view system

Sources: Interoperability with Java, Jahia Academy (page dated 24 October 2024).

Related terms: Template · Content Template · Component · Content item · Content Type

Resources that cover this term

View vs template: the differences

A view renders a content item. A template renders the page framework. A component is the visible result of combining a content item with its view.

Views among rendering concepts
ConceptWhat distinguishes it
TemplateA template defines the overall layout and the contribution areas. The rendering code only acts on a content item inside those areas.
ComponentA component combines a content item, based on a type, with its rendering to produce an HTML fragment for visitors.
Content TemplateA content template gives a full page to a content item that is not a page. It can rely on the renderings already defined for that item.

View in practice

A glossary entry appears in the index as a card (term and summary sentence) and at its own address as a full page. Both displays read the same content item through two different views. Correcting the summary in Content Editor updates both at once.

A new rendering should be tested on real content before it goes live, with empty optional fields, long texts, several languages and several screen sizes.

Frequently asked questions

Does displaying content in two ways mean duplicating it?

No. One content item can be rendered by several views, each suited to its context, without any copy. That is exactly what they are for. Editors maintain a single version. Duplicating content to get a different display is a sign that the missing rendering was never built. It is also a source of inconsistencies.

Do views have to be rewritten to move to React?

Since Jahia 8.2, JavaScript modules let teams write views and templates in JSX or TSX, rendered server side. Moving to React means writing new renderings in that format, since a view transforms stored content into HTML. The migration can be gradual: Jahia supports JavaScript and Java modules on the same site, even on the same page, and the Academy recommends one module type for a new project. The technical team scopes the pace.