Thymeleaf th:text - Put a text without removing HTML structures

I faced the same problem. The answer is th:inline='text'

This should solve your issue

<h1 th:inline="text" >
   [[${header.title}]]
   <small th:text="${header.subtitle}">Subtitle</small>
</h1>

or you can also use th:remove="tag"

<h1>
    <span th:text="${header.title}" th:remove="tag">title</span>
    <small th:text="${header.subtitle}" >Subtitle</small>
</h1>

Regardless of the semantics of tags, the correct answer is this one:

<h1>
    <span th:text="${header.title}" th:remove="tag">title</span>
    <small th:text="${header.subtitle}" >Subtitle</small>
</h1>

In this way Thymeleaf removes de <span> tag and the results is what you expect:

<h1> 
    TITLE 
    <small>SUBTITLE</small> 
</h1>

Regards!


in addition to @Faraj response, you can also use th:block like this

<h1>
   <th:block th:utext="${header.title}"/>
   <small th:text="${header.subtitle}" >Subtitle</small>
</h1>