Answers for "Layout Template"

0

Layout Template

<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title layout:title-pattern="$CONTENT_TITLE - $LAYOUT_TITLE"></title>

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
</head>
<body>

<!-- Main Navigation -->
<nav class="navbar navbar-expand-md navbar-dark bg-primary">
    <a class="navbar-brand" th:href="@{/}">Business Name</a>
    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar" aria-controls="navbar"
            aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
    </button>

    <div class="collapse navbar-collapse" id="navbar">
        <ul class="navbar-nav ml-auto">
            <li class="nav-item active">
                <a class="nav-link" th:href="@{/}">Home</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" th:href="@{/contact}">Contact Us</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" th:href="@{/about}">About Us</a>
            </li>
        </ul>
    </div>
</nav>

<!-- Content Section -->
<section layout:fragment="content">
    <p>This is filled by the content template.</p>
</section>

<!-- Footer -->
<footer class="container py-5">
    <div class="row">
        <div class="col-md-12">
            <p class="text-muted">© 2020 Business Name. All rights reserved.</p>
        </div>
    </div>
</footer>

<!-- Optional Section -->
<th:block layout:fragment="optional" />

</body>
</html>
Posted by: Guest on October-09-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language