Beispiel aus der Thymeleaf-Doku
authorKai Moritz <kai@juplo.de>
Wed, 24 Apr 2019 15:56:00 +0000 (17:56 +0200)
committerKai Moritz <kai@juplo.de>
Sun, 5 May 2019 16:28:49 +0000 (18:28 +0200)
dist/templates/example/layout.html [new file with mode: 0644]
dist/templates/example/page.html [new file with mode: 0644]

diff --git a/dist/templates/example/layout.html b/dist/templates/example/layout.html
new file mode 100644 (file)
index 0000000..82bd254
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html th:fragment="layout (title, content)" xmlns:th="http://www.thymeleaf.org">
+<head>
+    <title th:replace="${title}">Layout Title</title>
+</head>
+<body>
+    <h1>Layout H1</h1>
+    <div th:replace="${content}">
+        <p>Layout content</p>
+    </div>
+    <footer>
+        Layout footer
+    </footer>
+</body>
+</html>
diff --git a/dist/templates/example/page.html b/dist/templates/example/page.html
new file mode 100644 (file)
index 0000000..b0f81f4
--- /dev/null
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html th:replace="~{/templates/example/layout.html :: layout(~{::title}, ~{::section})}">
+<head>
+    <title>Page Title</title>
+</head>
+<body>
+<section>
+    <p>Page content</p>
+    <div>Included on page</div>
+</section>
+</body>
+</html>