-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Thymeleaf 3.0 Fragment Expression is giving error #165
Comments
Hi @esaruhan, I haven't debugged the code with your example templates yet (thanks for creating examples I can use to test against by the way 👍), but my gut is telling me the errors you're getting are because you're trying to mix 2 layout methods on a key element, the Because it's such a common scenario, the layout dialect automatically merges the elements of your However, by putting As you've already stated, you can use the layout dialect without the additional Template3.html <head>
<!-- Common styles and scripts -->
<link rel="stylesheet" type="text/css" media="all" th:href="@{/css/awesomeapp.css}"/>
</head> Content3.html <head>
<title>DEĞİŞTİRİLDİ TITTILE</title>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" th:href="@{/resources/css/first.css}" >
<link rel="stylesheet" type="text/css" th:href="@{/resources/css/second.css}" >
<link rel="stylesheet" type="text/css" th:href="@{/resources/css/fourth.css}" >
</head> Result: <head>
<title>DEĞİŞTİRİLDİ TITTILE</title>
<!-- Common styles and scripts -->
<link rel="stylesheet" type="text/css" media="all" th:href="@{/css/awesomeapp.css}"/>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" th:href="@{/resources/css/first.css}" >
<link rel="stylesheet" type="text/css" th:href="@{/resources/css/second.css}" >
<link rel="stylesheet" type="text/css" th:href="@{/resources/css/fourth.css}" >
</head> I'll get some time to eventually debug the code with your examples, but is there some reason you're trying to mix these 2 layout methods together? (I'm trying to understand what your use case might be.) |
Thanks for replying. I would like to use this dialect for the flexibility to design the layout as its main aim. But also i would like use fragment expression for adding extra fragments or not . Actually i should not try this both scenarios for head, as you mention about head tag its behaviours is different. My use case is : |
I've added an extra option that can be passed to the layout dialect during setup to tell it to disable the automatic Using the configuration option has been added to the docs: https://ultraq.github.io/thymeleaf-layout-dialect/Configuration.html This is now available in |
When it try to use thymeleaf-layout-dialect and flexible layout fragment expression, it gives error .
To implement this i created a project named ThymeleafExamples on github.
Resource : **8.3 Flexible layouts: beyond mere fragment insertion ** ( http://www.thymeleaf.org/doc/tutorials/3.0/usingthymeleaf.html#fragment-specification-syntax )
Scenario : I would like to use thymeleaf layout dialect, i can use it without fragment expression.
But when i use this with fragment expression and thymeleaf layout dialect i get an error.
The problem occurs when i insert the code below into Template3.html
<head th:fragment="common_header(title,links)">
I m using this in content page like this
<head th:replace="Template3 :: common_header(~{::title},~{::link})">
Content3.html
/~https://github.com/esaruhan/ThymeleafExamples/blob/master/src/main/resources/templates/Content3.html
Template3.html
/~https://github.com/esaruhan/ThymeleafExamples/blob/master/src/main/resources/templates/Template3.html
I am getting this error :
The text was updated successfully, but these errors were encountered: