There seems to be an issue using conditional tags in the layout template:
<head>
<th:block th:if="${false}">
<title>test</title>
</th:block>
</head>
The whole condition will be ignored and the title inside will be processed/rendered.
However this is working:
<head>
<title th:if="${false}">test</title>
</head>
Tested with version 2.5.1.