spring mvc - title not populating from content page -
i using thymeleaf spring-mvc create template in application. have created 3 files (head, layout , content) below;
head.html
<title>layout<title>
layout.html
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"> <head th:include="head"></head> </html>
content.html
<html layout:decorator="layout" xmlns="http://www.w3.org/1999/xhtml" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"> <head> <title>content</title> </head> </html>
setup, when run application , open content.html page see title "layout" instead of "content".
am doing wrong in configuration?
specific answer
in layout files title, make title content
<title layout:title-pattern="$content_title"></title>
further description
lets assume application main title "my web"
, viewing page content title "content"
to make page display title "my web - content"
layout file
<title layout:title-pattern="$decorator_title - $content_title">my web</title>
contentfile
<html layout:decorator="layout" xmlns="http://www.w3.org/1999/xhtml" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"> <head> <title>content</title> </head> </html>
Comments
Post a Comment