]> juplo.de Git - website/commitdiff
Templating für das Juplo-Layout überarbeitet
authorKai Moritz <kai@juplo.de>
Wed, 10 Dec 2025 18:51:38 +0000 (19:51 +0100)
committerKai Moritz <kai@juplo.de>
Sun, 21 Dec 2025 18:55:03 +0000 (19:55 +0100)
layouts/_partials/breadcrumb.html [new file with mode: 0644]
layouts/_partials/footer.html
layouts/_partials/header.html
layouts/_partials/marginalcontent.html [new file with mode: 0644]
layouts/_partials/menu.html
layouts/baseof.html
layouts/page.html
layouts/section.html
layouts/term.html

diff --git a/layouts/_partials/breadcrumb.html b/layouts/_partials/breadcrumb.html
new file mode 100644 (file)
index 0000000..aeeceb8
--- /dev/null
@@ -0,0 +1,14 @@
+<div id="breadcrumb">
+  <strong class="b title">You are here:</strong>
+  <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}}" th:text="${_titles.get(crumb)}">Projects</a>
+    </li>
+    <!--/*-->
+    <li class="b"><strong class="b" th:text="${title}">Fix SWF</strong></li>
+    <!--*/-->
+  </ol>
+  <a class="hide" href="#nav" title="Show navigation menu">Jump to navigation</a>
+  <hr class="b" />
+</div>
index a7cd916d054898baf4b77b5780c7d4843dc6ff4f..08fad685ca2fdfd83aa85f34692eb863698fffd2 100644 (file)
@@ -1 +1,8 @@
-<p>Copyright {{ now.Year }}. All rights reserved.</p>
+<footer id="footer">
+  <hr class="f" />
+  <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>
+  </ul>
+</footer>
index 7980a00e1e2613fa8adc68e98a99460bd6131422..78e6631a1153cef1e02977d91df87e71bd43a7aa 100644 (file)
@@ -1,2 +1,5 @@
-<h1>{{ site.Title }}</h1>
-{{ partial "menu.html" (dict "menuID" "main" "page" .) }}
+<header id="header"><!-- TODO: Vereinfachung -> für uri == index.html a gegen strong ausstauschen -->
+  <h1 id="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>
diff --git a/layouts/_partials/marginalcontent.html b/layouts/_partials/marginalcontent.html
new file mode 100644 (file)
index 0000000..94f3697
--- /dev/null
@@ -0,0 +1,20 @@
+<aside class="m" th:insert="${marginalcontent}?:~{}">
+<!--/* the following  is only visible during natural templating -->
+  <h1>Other nasty but marginal stuff</h1>
+  <p>
+    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
+    eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim
+    ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
+    aliquip ex ea commodo consequat. Duis aute irure dolor in
+    reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
+    pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
+    culpa qui officia deserunt mollit anim id est laborum.
+  </p>
+</aside>
+<aside class="m">
+  <h1>More nasty stuff</h1>
+  <p>
+    This one is really short!
+  </p>
+<!--*/-->
+</aside>
index 14245b55dba22b9498c3e93cf9eb7e4e7d6c0d75..a8d39bd130173143c78310cef85c117c480c766e 100644 (file)
@@ -1,51 +1,77 @@
-{{- /*
-Renders a menu for the given menu ID.
-
-@context {page} page The current page.
-@context {string} menuID The menu ID.
-
-@example: {{ partial "menu.html" (dict "menuID" "main" "page" .) }}
-*/}}
-
 {{- $page := .page }}
 {{- $menuID := .menuID }}
 
-{{- with index site.Menus $menuID }}
-  <nav>
-    <ul>
-      {{- partial "inline/menu/walk.html" (dict "page" $page "menuEntries" .) }}
-    </ul>
-  </nav>
-{{- end }}
-
-{{- define "_partials/inline/menu/walk.html" }}
-  {{- $page := .page }}
-  {{- range .menuEntries }}
-    {{- $attrs := dict "href" .URL }}
-    {{- if $page.IsMenuCurrent .Menu . }}
-      {{- $attrs = merge $attrs (dict "class" "active" "aria-current" "page") }}
-    {{- else if $page.HasMenuCurrent .Menu .}}
-      {{- $attrs = merge $attrs (dict "class" "ancestor" "aria-current" "true") }}
-    {{- end }}
-    {{- $name := .Name }}
-    {{- with .Identifier }}
-      {{- with T . }}
-        {{- $name = . }}
-      {{- end }}
+<nav id="nav">
+  <hr class="n"/>
+  <a class="hide" href="#top" title="Show Content">Jump back to the top of the page</a>
+  <h1 class="nav">Navigation</h1>
+  <h2 class="nav menu">Section-Menu</h2>
+  <ul id="menu" class="cf">
+    {{- range $page.Site.MainSections }}
+    {{- $section := site.GetPage "section" . }}
+    <li class="m {{ . }}">
+      <a href="{{ $section.RelPermalink }}" class="{{ cond (eq $page.Section .) "m selected" "m" }}">{{ $section.LinkTitle }}</a>
+    </li>
     {{- end }}
-    <li>
-      <a
-        {{- range $k, $v := $attrs }}
-          {{- with $v }}
-            {{- printf " %s=%q" $k $v | safeHTMLAttr }}
-          {{- end }}
-        {{- end -}}
-      >{{ $name }}</a>
-      {{- with .Children }}
-        <ul>
-          {{- partial "inline/menu/walk.html" (dict "page" $page "menuEntries" .) }}
-        </ul>
+  </ul>
+  <h2 class="nav submenu">
+    <a class="s selected" href="{{ site.Home.RelPermalink }}">Home</a>
+  </h2>
+  <ul id="submenu" class="submenu selected">
+  {{- partial "inline/menu/tree.html" (dict "pages" $page.Site.Sections "page" $page) }}
+  {{- define "_partials/inline/menu/tree.html" }}
+    {{- $page := .page -}}
+    {{- range .pages -}}
+    {{- $parent := index .Ancestors 0 -}}
+    {{- $isCurrent := eq . $page -}}
+    {{- $isAncestor := $page.IsDescendant . -}}
+    {{- $isChild := $parent.Eq $page }}
+    {{- $isSibling := $parent.Eq (index $page.Ancestors 0) }}
+    <li class="s{{ if or .Pages .Sections}} sub{{ end }}{{ if not (or $isCurrent $isAncestor (and $isSibling (not $page.IsNode)) $isChild) }} off{{ end }}">
+      <!--
+        th:with="
+            child=${pos == len},
+            hidden=${!child && _canonical.get(crumbs.get(pos)) == entry},
+            entry=${hidden?crumbs.get(pos):entry},
+            selected=${(child and crumbs.get(pos-1) + '?about' == entry) or (!child and (crumbs.get(pos) == entry or hidden))},
+            leaf=${pos >= (len - 1) and not selected},
+            sibling=${pos + 1 == len and (_childs.get(uri) == null or uri == parent)},
+            childs=${entry == parent ? null : _childs.get(entry)}
+            "
+        class="s sub"
+        th:class="'s' + (${childs} ? ' sub' : '') + (${selected or sibling or child} ? '' : ' off')"
+      -->
+      <a  href="{{ .RelPermalink }}"
+          class="s {{ if (or $isCurrent $isAncestor) }} selected{{ end }}"
+          >{{ .LinkTitle }}</a>
+      <!--
+      <ul>
+        <li>.: {{ .Path }}</li>
+        <li>$parent: {{ $parent.Path }}</li>
+        <li>$page: {{ $page.Path }}</li>
+        <li>$page.IsNode: {{ $page.IsNode }}</li>
+        <li>$isCurrent: {{ $isCurrent }}</li>
+        <li>$isAncestor: {{ $isAncestor }}</li>
+        <li>$isSibling: {{ $isSibling }}</li>
+        <li>$isChild: {{ $isChild }}</li>
+        <li>.Eq $page: {{ .Eq $page }}</li>
+        <li>.IsAncestor $page: {{ .IsAncestor $page }}</li>
+        <li>.IsDescendant $page: {{ .IsDescendant $page }}</li>
+      </ul>
+      -->
+      {{ if or .Pages .Sections }}
+      <ul class="s{{ if (or $isCurrent $isAncestor) }} active{{ end }}">
+        {{- if .Pages }}
+          {{- partial "inline/menu/tree.html" (dict
+              "pages" .Pages
+              "page" $page
+          ) }}
+        {{- end }}
+      </ul>
       {{- end }}
     </li>
+    {{- end }}
   {{- end }}
-{{- end }}
+  </ul>
+  <hr class="n"/>
+</nav>
index 39dcbec61fc7176b6b73a802b29dcc4508775836..0bb66c6e365c9a56cedd879a4428fedf67c08dcc 100644 (file)
@@ -3,15 +3,21 @@
 <head>
   {{ partial "head.html" . }}
 </head>
-<body>
-  <header>
-    {{ partial "header.html" . }}
-  </header>
-  <main>
-    {{ block "main" . }}{{ end }}
-  </main>
-  <footer>
-    {{ partial "footer.html" . }}
-  </footer>
+<body id="top" class="menu" onload="prettyPrint()">
+  <div id="page" class="cf">
+    {{- partial "header.html" . }}
+    {{- partial "breadcrumb.html" . }}
+    <main class="content cf">
+        <article id="content" class="main">
+          <header><h1>{{ .Title }}</h1></header>
+          {{- block "main" . }}{{ end }}
+        </article>
+        <div class="marginal">
+          {{- partial "menu.html" (dict "menuID" "main" "page" .) }}
+          {{- partial "marginalcontent.html" . }}
+        </div>
+    </main>
+    {{- partial "footer.html" . }}
+  </div>
 </body>
 </html>
index 7e286c80218e935af6181f62bdcc83f5fd9b197f..30fcf482e54166f3973ff7b446a2b20141e83e0e 100644 (file)
@@ -1,6 +1,4 @@
 {{ define "main" }}
-  <h1>{{ .Title }}</h1>
-
   {{ $dateMachine := .Date | time.Format "2006-01-02T15:04:05-07:00" }}
   {{ $dateHuman := .Date | time.Format ":date_long" }}
   <time datetime="{{ $dateMachine }}">{{ $dateHuman }}</time>
index 4cfd224d4f97defb4d587a2ca358e4ddeb6aff64..e0e83081c7ec276eb408efb4b52051c1cc4a2144 100644 (file)
@@ -1,4 +1,3 @@
 {{ define "main" }}
-  <h1>{{ .Title }}</h1>
   {{ .Content }}
 {{ end }}
index c2e787519e61886e914c468f206485f570ce3b37..7c5437dd063c4c2eab02c6a00d7de7a19e338f1d 100644 (file)
@@ -1,5 +1,4 @@
 {{ define "main" }}
-  <h1>{{ .Title }}</h1>
   {{ .Content }}
   {{ range .Pages }}
     <h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2>