Page Titles

Learn to use title-pattern to automate the naming of page titles.

Layout dialect support

The Thymeleaf Layout Dialect has special support for page titles. Suppose we want all our pages to have a title that starts with My Application and be suffixed with something that the page is about. For example, My Application - Users or My Application - Dashboard.

If we define <title> each time on each page, we must keep repeating the first part, thus making it hard to change afterwards.

A better way to do this is by using layout:title-pattern. This allows us to define the structure of the title at the layout level and add the correct suffix at the page level.

Example

For example, suppose this is the <head> section of the layout:

Get hands-on with 1300+ tech skills courses.