summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--layouts/_default/baseof.html31
-rw-r--r--layouts/_default/list.html4
-rw-r--r--layouts/_default/single.html4
-rw-r--r--layouts/partials/footer.html21
-rw-r--r--layouts/partials/header.html46
5 files changed, 56 insertions, 50 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
new file mode 100644
index 0000000..4035dd6
--- /dev/null
+++ b/layouts/_default/baseof.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html lang="{{ .Site.LanguageCode }}">
+
+<head>
+ {{- partial "head.html" . }}
+</head>
+
+<body class="{{ if eq .Kind `page` }}single{{ else }}list{{ if .IsHome }} home{{ end }}{{ end }}">
+ <script>
+ setTheme();
+ </script>
+ <header class="header">
+ {{- partial "header.html" . }}
+ </header>
+
+ <main class="main">
+ {{- block "main" . }}
+ {{end }}
+ </main>
+
+ <footer class="footer">
+ {{- partial "footer.html" . }}
+ </footer>
+ {{ $highlight := resources.Get "highlight.min.js" | minify }}
+ <script src="{{ $highlight.Permalink }}"></script>
+ <script>
+ hljs.initHighlightingOnLoad();
+ </script>
+</body>
+
+</html> \ No newline at end of file
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
index 96863ba..969f98b 100644
--- a/layouts/_default/list.html
+++ b/layouts/_default/list.html
@@ -1,4 +1,4 @@
-{{- partial "header.html" . }}
+{{ define "main" }}
{{- $scope := .Site }}
@@ -39,4 +39,4 @@
</footer>
{{- end }}
-{{- partial "footer.html" . }} \ No newline at end of file
+{{ end }}{{/* end main */}} \ No newline at end of file
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 0897600..842fa31 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -1,4 +1,4 @@
-{{- partial "header.html" . }}
+{{ define "main" }}
<article class="post-single">
<header class="post-header">
@@ -26,4 +26,4 @@
{{- end }}
</article>
-{{- partial "footer.html" . }} \ No newline at end of file
+{{ end }}{{/* end main */}} \ No newline at end of file
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
index c186c8f..11cff65 100644
--- a/layouts/partials/footer.html
+++ b/layouts/partials/footer.html
@@ -1,16 +1,5 @@
-</main>
-<footer class="footer">
- <span>&copy; {{ now.Year }} <a href="{{ "" | absURL }}">{{ .Site.Title }}</a></span>
- <span>&middot;</span>
- <span>Powered by <a href="https://gohugo.io/" rel="noopener" target="_blank">Hugo️️</a>️</span>
- <span>&middot;</span>
- <span>Theme️ <a href="https://github.com/nanxiaobei/hugo-paper" rel="noopener" target="_blank">Paper</a></span>
-</footer>
-{{ $highlight := resources.Get "highlight.min.js" | minify }}
-<script src="{{ $highlight.Permalink }}"></script>
-<script>
- hljs.initHighlightingOnLoad();
-</script>
-</body>
-
-</html> \ No newline at end of file
+<span>&copy; {{ now.Year }} <a href="{{ "" | absURL }}">{{ .Site.Title }}</a></span>
+<span>&middot;</span>
+<span>Powered by <a href="https://gohugo.io/" rel="noopener" target="_blank">Hugo️️</a>️</span>
+<span>&middot;</span>
+<span>Theme️ <a href="https://github.com/nanxiaobei/hugo-paper" rel="noopener" target="_blank">Paper</a></span> \ No newline at end of file
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
index 938d24c..c1cc59e 100644
--- a/layouts/partials/header.html
+++ b/layouts/partials/header.html
@@ -1,30 +1,16 @@
-<!DOCTYPE html>
-<html lang="{{ .Site.LanguageCode }}">
-
-<head>
- {{- partial "head.html" . }}
-</head>
-
-<body class="{{ if eq .Kind `page` }}single{{ else }}list{{ if .IsHome }} home{{ end }}{{ end }}">
- <script>
- setTheme();
- </script>
- <header class="header">
- <nav class="nav">
- {{- if .IsHome }}
- <h1 class="logo"><a href="{{ "" | absURL }}">{{ .Site.Title }}</a></h1>
- {{- else }}
- <p class="logo"><a href="{{ "" | absURL }}">{{ .Site.Title }}</a></p>
- {{- end }}
- {{- if .Site.Menus.main }}
- <ul class="menu">
- {{- range .Site.Menus.main }}
- <li>
- <a href="{{ .URL }}">{{ .Name }}</a>
- </li>
- {{- end }}
- </ul>
- {{- end }}
- </nav>
- </header>
- <main class="main"> \ No newline at end of file
+<nav class="nav">
+ {{- if .IsHome }}
+ <h1 class="logo"><a href="{{ "" | absURL }}">{{ .Site.Title }}</a></h1>
+ {{- else }}
+ <p class="logo"><a href="{{ "" | absURL }}">{{ .Site.Title }}</a></p>
+ {{- end }}
+ {{- if .Site.Menus.main }}
+ <ul class="menu">
+ {{- range .Site.Menus.main }}
+ <li>
+ <a href="{{ .URL }}">{{ .Name }}</a>
+ </li>
+ {{- end }}
+ </ul>
+ {{- end }}
+</nav> \ No newline at end of file