Head and Title in Thymeleaf

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

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

fragments/layout.html



        
7条回答
  •  醉酒成梦
    2021-01-31 18:54

    According to the documentation th:include includes the content of a fragment into the including div. So you will get the title of template. You can use an attribute for the page title as follows and set its value in each controller.

    
       ${pagetitle}
       
    
    

    Alternatively you can use layout dialects to achieve the same as described in here. Thymeleaf layout dialect and th:replace in head causes title to be blank

提交回复
热议问题