commit 11d59ffa1bf94386196d85c05ee0eaabe76f7f96
parent ec39d27ce2f194a936230290aebfb4683e7d658f
Author: Luke Smith <luke@lukesmith.xyz>
Date: Tue, 20 Sep 2022 17:10:53 -0400
use baseof, close #10
Diffstat:
5 files changed, 53 insertions(+), 44 deletions(-)
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html lang="{{ .Site.Language }}">
+<head>
+ <title>{{ if not .IsHome }}{{ .Title | title }} | {{ end }}{{ .Site.Title }}</title>
+ <link rel="canonical" href="{{ .Site.BaseURL }}">
+ <link rel='alternate' type='application/rss+xml' title="{{ .Site.Title }} RSS" href='/index.xml'>
+ <link rel='stylesheet' type='text/css' href='/style.css'>
+ {{ with .Site.Params.favicon }}<link rel="icon" href="{{ . }}">
+ {{ end -}}
+ <meta name="description" content="{{ with .Params.description }}{{ . }}{{ else }}{{ .Summary }}{{ end }}">
+ {{ if isset .Params "tags" }}<meta name="keywords" content="{{ with .Params.tags }}{{ delimit . ", " }}{{ end }}">
+ {{ end -}}
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <meta name="robots" content="index, follow">
+ <meta charset="utf-8">
+</head>
+<body>
+{{ if .Site.Menus.main }}{{ partial "nav.html" . }}{{ end -}}
+<main>
+<header><h1 id="tag_{{ .Title }}">{{ block "title" . }}{{ end }}</h1></header>
+<article>
+{{ block "main" . }}
+{{ .Content }}
+{{ end }}
+{{ if .Param "nextprev" }}{{ partial "nextprev.html" . -}}{{ end -}}
+{{ if .Param "taglist" }}{{ partial "taglist.html" . }}{{ end -}}
+</article>
+</main>
+{{ block "footer" . }}
+<footer>
+ <a href="{{ .Site.BaseURL }}">{{ .Site.BaseURL }}</a>
+ {{- if .Param "showrss" }}<br><br><a href="/index.xml"><img src="/rss.svg" style="max-height:1.5em" alt="RSS Feed" title="Subscribe via RSS for updates."></a>{{ end }}
+</footer>
+{{ end }}
+</body>
+</html>
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
@@ -1,11 +1,17 @@
-{{ partial "header.html" . -}}
-<header><h1 id="tag_{{ .Title }}">{{ .Title | title }}</h1></header>
-<article>
-{{ .Content -}}
+{{ define "title" -}}
+{{ .Title | title }}
+{{- end }}
+{{ define "main" -}}
+{{ .Content }}
<ul>
{{- range.Pages }}
- <li><time datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format "2006 Jan 02" }}</time> – <a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
-{{ end -}}
+ <li>
+ {{- if .Param "datesinlist" }}<time datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format "2006 Jan 02" }}</time> – {{ end -}}
+ <a href="{{ .RelPermalink }}">{{ .Title }}</a>
+ {{- if .Param "authorsinlist" }}
+ {{- range .Param "authors" }} by {{ . }}{{ end -}}
+ {{ end -}}
+ </li>
+{{- end }}
</ul>
-</article>
-{{- partial "footer.html" . }}
+{{- end }}
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
@@ -1,5 +1,3 @@
-{{ partial "header.html" . -}}
-<header><h1>{{ .Title }}</h1></header>
-<article>
-{{ .Content -}}
-{{ partial "footer.html" . }}
+{{ define "title" -}}
+{{ .Title }}
+{{- end }}
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
@@ -1,10 +0,0 @@
-{{ partial "nextprev.html" . -}}
-{{ partial "taglist.html" . -}}
-</article>
-</main>
-<footer>
- <a href="{{ .Site.BaseURL }}">{{ .Site.BaseURL }}</a><br><br>
- <a href="/index.xml"><img src="/rss.svg" style="max-height:1.5em" alt="RSS Feed" title="Subscribe via RSS for updates."></a>
-</footer>
-</body>
-</html>
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
@@ -1,21 +0,0 @@
-<!DOCTYPE html>
-<html lang="{{ .Site.Language }}">
-<head>
- <title>{{ if not .IsHome }}{{ .Title | title }} | {{ end }}{{ .Site.Title }}</title>
- <link rel="canonical" href="{{ .Site.BaseURL }}">
- <link rel='alternate' type='application/rss+xml' title="{{ .Site.Title }} RSS" href='/index.xml'>
- <link rel='stylesheet' type='text/css' href='/style.css'>
- {{ with .Site.Params.favicon }}<link rel="icon" href="{{ . }}">
- {{ end -}}
- <meta name="description" content="{{ with .Params.description }}{{ . }}{{ else }}{{ .Summary }}{{ end }}">
- {{ if isset .Params "tags" }}<meta name="keywords" content="{{ with .Params.tags }}{{ delimit . ", " }}{{ end }}">
- {{ end -}}
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <meta name="robots" content="index, follow">
- <meta charset="utf-8">
-</head>
-<body>
-{{- if .Site.Menus.main }}
-{{ partial "nav.html" . }}
-{{ end }}
-<main>