i just decieded to start a little project with spring-boot and thymeleaf.
thymeleaf itself looks awesome until now, but my question is what is the best way to have one e.g. layout.html that brings the basic layout of the page
like
- common css inclusions
- common js inclusions
- basic structure (eg 2/3 column layout)
that is wrapped arround the content of the single pages (view blog post, view comments, view image in gallery, and so on) that i dont need to carry the common stuff into all templates.
until now the only way i found is using fragment inclusions but i'm not sure if this is the correct approach to get a full structure arround the template i want to render for the current request
like how would i get a <div class="content"></div>
arround my template?
i hope someone can help.
thanks in advance
You have couple of choices: Tiles Extension, Layout Dialect - you can find both in Ecosystem page here: http://www.thymeleaf.org/ecosystem.html
And native approach (without any extension) described in this comment:
http://blog.codeleak.pl/2013/11/is-it-worth-upgrading-to-thymeleaf-21.html?showComment=1383817035384#c5722173744814267184
I hope it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With