Search code examples
htmlspring-boot

Why my pics and css disapears on diffirent pages?


So, I'm making site with spring boot, and I've decided to make base.html, that gets extended with other html files.

<html xmlns:th="http://www.thymeleaf.org">

<head>
    <!--    <title th:text="${title}"></title>-->
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="../static/tailwind.css" rel="stylesheet">
    <link rel="icon" type="image/x-icon" href="/siteimg/Sambona_logo_mini3.webp">
</head>

<body class="relative">
<div class="flex flex-col min-h-screen">
    <div th:insert="~{${#strings.concat(page_lang, '/parts/nav')}}"></div>
    <!--passing a page content, basically I use base.html as
main page and extend that with page content that I need-->
    <div class="containter flex-1">
        <div th:insert="~{${#strings.concat(page_lang, '/', page_content)}}"></div>
    </div>
    <div th:insert="~{${#strings.concat(page_lang, '/parts/footer')}}"></div>
    <div class="toast toast-top toast-end">
    </div>
</div>
</body>

</html>

Page that extends this base.html

<div th:fragment="page-content">
    <div th:text="${page_text}" ></div>
<!--   Make carousel-->
</div>

If it's a starter page "sitename/RU", everything works right. If I get further in site like "sitename/RU/about", CSS path and image paths stop working

So, what I want is to know how to fix that or some info about how those paths work in Spring boot.


Solution

  • So, the problem was in css path, the right one was "/tailwind.css" so, if you will write "tailwind.css" it will take another path.