Use a Thymeleaf template without including the fragment definition element?
Use th:remove=”tag”. (documentation) fragments/main.html: <!DOCTYPE html> <html> <head></head> <body> <div th:fragment=”content” th:remove=”tag”> <p>This is the main content.</p> </div> </body> </html>