My html other pages is in the edit folder.
I am currently using this script below
<!--/*/ <th:block th:include="fragments/header :: header"></th:block> /*/-->
Script above works if the html document is in the same directory. (Eg; index.html is able to read the fragments). But I created a new directory(named: edit) to store my html pages. I need to get out of the current folder so it would be able to find the fragment folder using ../
<!--/*/ <th:block th:include="../fragments/header :: header"></th:block> /*/-->
But this method does not work. How would I be able to exit out a folder using this syntax?
It looks like you are using Spring Boot. Spring Boot autoconfigures Thymeleaf to find all HTML files in /templates
.
In the default application.properties you can see it:
spring.thymeleaf.prefix=classpath:/templates/
So (because Thymeleaf uses /templates
as root) that should work:
<th:block th:include="fragments/header :: header"></th:block>
And/or:
<th:block th:include="/fragments/header :: header"></th:block>
You don't "need to get out of the current folder".
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