Head and Title in Thymeleaf

前端 未结 7 1240
我寻月下人不归
我寻月下人不归 2021-01-31 18:23

I\'m a Thymeleaf beginner. I started with a common layout page:

fragments/layout.html



        
7条回答
  •  甜味超标
    2021-01-31 19:19

    Check out Parameterizable fragment signatures.

    Basically, in your fragment:

    
    
    
        
            Some text
        </div>
    </body>
    </html>
    </code></pre>
    
    <p>Then, where you use it:</p>
    
    <pre><code><!DOCTYPE html>
    <html xmlns:th="http://www.thymeleaf.org">
    <head th:replace="fragments/layout :: headerFragment (pageTitle='Bla Bla Some Title'">
        <title>Page title
        
    
    
        
    Some text

提交回复
热议问题