layout-dialect ausgebaut: Thymeleaf 3.x erlaubt ähnliches mit Bordmitteln
[website] / dist / templates / layout.html
index 70e1017..007770a 100644 (file)
@@ -2,11 +2,11 @@
 <html
     xmlns="http://www.w3.org/1999/xhtml"
     xmlns:th="http://www.thymeleaf.org"
-    xmlns:layout="http://www.thymeleaf.org"
+    th:fragment="layout(uri)"
     thymeproxy:variables="SET:sitemap.json"
     >
-  <head th:fragment="head" layout:fragment="head">
-    <title layout:title-pattern="$DECORATOR_TITLE - $CONTENT_TITLE" th:text="'juplo'">juplo - BASISTEMPLATE</title>
+  <head>
+    <title th:replace="~{::#title}">juplo - BASISTEMPLATE</title>
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
     <meta name="viewport" content="width=device-width, initial-scale=1" />
     <!-- Default / Responsive -->
@@ -36,6 +36,7 @@
     <![endif]-->
   </head>
   <body
+      th:fragment="body(uri)"
       thymeproxy:variables="${json}"
       th:with="page=${pages.get(uri)},crumbs=${page['crumbs']}"
       id="top"
       onload="prettyPrint()"
       >
     <div id="page" class="cf">
-      <header id="header">
-        <h1 id="logo" layout:fragment="header"><a href="../index.html" th:href="@{/}" title="Home" class="l"><img class="l" src="/img/logo.svg" alt="juplo"/></a></h1>
+      <header id="header"><!-- TODO: Vereinfachung -> für uri == index.html a gegen strong ausstauschen -->
+        <h1 id="logo" th:include="~{::#logo}"><a href="../index.html" th:href="@{/}" title="Home" class="l" ><img class="l" src="/img/logo.svg" alt="juplo"/></a></h1>
         <span id="slogan"><strong>Java</strong> bits from nerds for nerds</span>
         <hr class="h" />
       </header>
       <div id="breadcrumb">
         <strong class="b title">You are here:</strong>
-        <ol class="b" layout:fragment="breadcrumb">
+        <ol class="b" th:include="~{::#crumbs}?:_">
           <li class="b"><a class="b" href="../index.html" th:href="@{/index.html}">Home</a></li>
           <li class="b" th:each="crumb: ${crumbs}">
             <a class="b" href="../projects.html" th:href="@{${crumb.uri}}" th:text="${crumb.name}">Projects</a>
@@ -64,8 +65,8 @@
         <hr class="b" />
       </div>
       <main class="content cf">
-        <article id="content" class="main" layout:fragment="maincontent" th:class="'main'">
-          <header><h1 th:text="${title}">juplo - BASISTEMPLATE</h1></header>
+        <article id="content" class="main" th:include="~{::.maincontent}">
+          <header><h1 th:include="${title}">juplo - BASISTEMPLATE</h1></header>
           <div th:fragment="maincontent">
             <p>
               <strong>Lorem ipsum</strong> dolor
         </article>
         <div class="marginal">
           <nav id="nav"
-              layout:fragment="navigation"
+              th:include="~{::#navigation}?:_"
               th:with="section=${crumbs != null ? crumbs[0] : null}"
               >
             <hr class="n"/>
               <span class="s">Submenu for section</span>
               <a class="s selected" href="../projects.html" th:href="@{${section.uri}}" th:text="${section.name}">Projects</a>
             </h2>
-            <ul layout:fragment="submenu"
+            <ul th:include="${submenu}?:_"
                 th:with="
                   len=${crumbs.size()},
                   submenu=${pages[section.uri]['childs']},
             </ul>
             <hr class="n"/>
           </nav>
-          <aside class="m" layout:fragment="marginalcontent" th:remove="tag">
+          <aside class="m" th:insert="~{::.marginalcontent}?:~{}">
           <!--/* the following  is only visible during natural templating -->
             <h1>Other nasty but marginal stuff</h1>
             <p>
       </main>
       <footer id="footer">
         <hr class="f" />
-        <ul id="footerlinks" layout:fragment="footer">
+        <ul id="footerlinks" th:include="~{::#links}?:_">
           <li class="f" id="copyright">© <strong>mo</strong> 2013</li>
           <li class="f"><a class="f" href="../impressum.html" th:href="@{/impressum.html}">Impressum</a></li>
           <li class="f"><a class="f" href="../datenschutz.html" th:href="@{/datenschutz.html}">Datenschutz</a></li>