major refactor, card pagination beta testing
[kengrimes.com/theme.git] / layouts / _default / baseof.html
index 1f102a4..3f7a35d 100644 (file)
@@ -2,8 +2,8 @@
 <html>
   <head>
     <title>{{ .Site.Title }}{{ if .Page.Title }} :: {{ .Page.Title }}{{ end }}</title>
-    <link rel="stylesheet" href="{{relURL `/css/main.css`}}">
-    <script src="{{relURL `/js/main.js`}}"></script>
+    <link rel="stylesheet" href="/css/speedy.css">
+    <script src="/js/speedy.js"></script>
     <meta charset="utf-8" />
     <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
     {{ .Hugo.Generator }}
   <body>
     <header>
       {{- $sp := .Site.GetPage "section" .Section }}
-      {{- $ph := .Page.Resources.GetMatch "header.png" -}}
-      {{- $ph := cond (not $ph) ($sp.Resources.GetMatch "header.png") $ph }}
-      {{- $ph := cond (not $ph) (relURL "/img/speedy.png") $ph.RelPermalink }}
+      {{- $sh := cond (or (not $sp.Params.header) (not (fileExists (printf "static/%s" $sp.Params.header)))) (cond (or (not .Site.Home.Params.header) (not (fileExists (printf "static/%s" .Site.Home.Params.header)))) "/img/speedy.png" .Site.Home.Params.header) $sp.Params.header }}
+      {{- $sc := cond (or (not $sp.Params.caption)) (cond (not .Site.Home.Params.caption) .Site.Title .Site.Home.Params.caption) $sp.Params.caption }}
+      {{- $ph := cond (or (not .Params.header) (not (fileExists (printf "static/%s" .Params.header)))) $sh .Params.header }}
       <img src="{{ $ph }}">
       <div>
-        {{ $caption := cond (not .Page.Params.caption) (cond (not $sp.Params.caption) .Site.Title $sp.Params.caption) .Page.Params.caption }}
+        {{ $caption := cond (not .Params.caption) $sc .Params.caption }}
         {{- if (eq (printf "%T" $caption) "string") }}
         {{- $caption -}}
         {{- else }}
     <nav>
       <div>
         {{- $pg := . }}
-        {{- range union (where .Site.Menus.main "Weight" 0).Reverse (where .Site.Menus.main "Weight" "!=" 0) }}
-        <a href="{{ .URL }}">
+        {{- range .Site.Menus.main }}
+        <a href="{{ absURL .URL }}">
           <summary>{{ .Name }}</summary>
-          <svg{{- if or ($pg.InSection .Page) (eq .Page $sp) }} class="selected"{{ end }}>
-            <use xlink:href="{{ relURL `/img/nav.svg` }}#{{ .Name }}"/>
+          <svg{{- if or ($pg.InSection .Page) (eq .Page $pg) }} class="selected"{{ end }}>
+            <use xlink:href="{{ relURL `/img/nav.svg` | safeHTML }}#{{ .Name }}"/>
           </svg>
         </a>
         {{- end }}