Nested layout fragment stopped working
manuellp12 opened this issue · comments
I have a layout setup that works like this:
Base.html
<th:block layout:fragment="content">
<th:block layout:fragment="content-header">
</th:block>
<th:block layout:fragment="content-body">
</th:block>
</th:block>
Index.html
<th:block layout:fragment="content-header">
MY HEADER CONTENT
</th:block>
<th:block layout:fragment="content-body">
MY BODY CONTENT
</th:block>
Back in version 2.3.0 this was working OK.
Now in version 2.4.0 this is not working and content-header and content-body are resolved empty.
Are you able to either show more of the HTML you're using or provide a small project/test case that has the problem? I created a Thymeleaf test case based on what you've posted, but I still managed to get the expected output (in the %OUTPUT
section at the end of the Thymeleaf test file example below) and no blank content-header/content-body:
%TEMPLATE_MODE HTML
%INPUT
<!DOCTYPE html>
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" layout:decorate="~{Base}">
<th:block layout:fragment="content-header">MY HEADER CONTENT</th:block>
<th:block layout:fragment="content-body">MY BODY CONTENT</th:block>
</html>
%INPUT[Base]
<!DOCTYPE html>
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout">
<th:block layout:fragment="content">
<th:block layout:fragment="content-header"></th:block>
<th:block layout:fragment="content-body"></th:block>
</th:block>
</html>
%OUTPUT
<!DOCTYPE html>
<html>
MY HEADER CONTENT
MY BODY CONTENT
</html>
(The only difference between what you gave me and what I've tried are that I've added <html>
elements around the items so that I can add the layout:decorate
directive.)
Old issue w/ no response from OP, so will close. If anybody else has this problem and can provide more information, feel free to comment and I might reopen it for more investigation.