Partial views in Thymeleaf

Does Thymeleaf in Enonic XP (6.0.0) support partial views with include/fragment as explained here:

http://www.thymeleaf.org/doc/articles/layouts.html

?

I’ve read the Thymeleaf docs, but cannot make it work.

This is my code so far. Both files are currently in the same folder, let’s say site/parts/article. (In the future, I’d like to move status-badge.html to a different, shared folder, e.g. site/views.)

article.html:

<p data-th-include="status-badge :: badge"></p>

status-badge.html:

<p data-th-fragment="badge">My status</p>

The latest status on this is that local fragments are working, but not yet fragments from other files. In version 6 there was changes to how thymeleaf was included as a lib in each app, but I don’t think that affects how fragments are rendered.

There is a task (XP-277) which adresses this feature in thymeleaf, and as I can see it is scheduled for release in version 6.1.0, but I am not sure that this is updated information, as the task does not have a scheduled sprint. @srs is currently assigned to the task, so perhaps he can say more about status.

Hi.

Sorry about this, but the Thymeleaf fragments has to wait for 6.2. It’s a relatively easy job, but I had no time to do it for 6.1.

BR,
Sten Roger

2 Likes

I am happy to say that fragments are now implemented in 6.1.

6 Likes