How to add additional content to fragment in Thymeleaf 3
<p>I'd like to add additional content to a fragment using <a href="http://www.thymeleaf.org/doc/tutorials/3.0/usingthymeleaf.html#template-layout" rel="nofollow">Thymeleaf 3 layouts</a>, but cannot figure out how to do it. For example, I'd like to have a fragment named <code>layout</code> that looks like:</p>

<pre><code>&lt;head th:fragment="head(title)"&gt;
  &lt;title th:include="${title}"&gt;My App: &lt;/title&gt;
&lt;/head&gt;
</code></pre>

<p>Then have a template that uses the fragment above using:</p>

<pre><code>&lt;head th:include="layout :: head(title=~{::title})"&gt;
    &lt;title&gt;Please Login&lt;/title&gt;
&lt;/head&gt;
</code></pre>

<p>The content renders like:</p>

<pre><code>&lt;head&gt;
    &lt;title&gt;Please Login&lt;/title&gt;
&lt;/head&gt;
</code></pre>

<p>However, I would like to modify the templates so that it renders like the following and placing <code>My App:</code> in the <code>layout</code> template (I don't want to have to duplicate it).</p>

<pre><code>&lt;head&gt;
    &lt;title&gt;My App: Please Login&lt;/title&gt;
&lt;/head&gt;
</code></pre>

<p>I can get this to work using the following:</p>

<pre><code>&lt;head th:fragment="head(title)"&gt;
  &lt;title th:include="${title}"&gt;My App: &lt;th:block th:include="${title}"&gt;&lt;/th:block&gt;&lt;/title&gt;
&lt;/head&gt;
</code></pre>

<p>However, the Thymeleaf discourages the use of <code>th:include</code>. <a href="http://www.thymeleaf.org/doc/tutorials/3.0/usingthymeleaf.html#difference-between-thinsert-and-threplace-and-thinclude" rel="nofollow">From the reference</a>:</p>

<blockquote>
  <p>And what is the difference between th:insert and th:replace (and
  th:include, not recommended since 3.0)?</p>
</blockquote>

<p>Can someone tell me how to fix my templates so that it renders as shown above using best practices (As mentioned the reference implies this means not using <code>th:include</code>)?</p>