Move site header and footer to the base template, and override the body block in index

This commit is contained in:
Eryn Wells 2022-11-15 22:12:09 -08:00
parent 19d8209cb2
commit 8fadc54a43
3 changed files with 17 additions and 21 deletions

View file

@ -4,13 +4,15 @@
<body> <body>
{{ block "body" . -}} {{ block "body" . -}}
{{ block "header" . }}{{ end }} {{ block "header" . }}{{ partial "header.html" .}}{{ end }}
<main class="{{ .Type }} {{ .Kind }}{{ if gt (len .Pages) 0 }} list{{ end }}"> <main class="{{ .Type }} {{ .Kind }}{{ if gt (len .Pages) 0 }} list{{ end }}">
{{ block "main" . }}{{ end }} {{ block "main" . }}{{ end }}
</main> </main>
{{- partial "development/page_info.html" . -}} {{- block "footer" . -}}
{{- block "footer" . -}}{{- end -}} {{ partial "footer.html" . }}
{{- end -}} {{- end -}}
{{- end -}}
{{- partial "development/page_info.html" . -}}
</body> </body>
{{ with partial "resources/root_css.html" . -}} {{ with partial "resources/root_css.html" . -}}

View file

@ -1,7 +1,3 @@
{{ define "header" }}
{{ partial "header.html" . }}
{{ end }}
{{ define "main" }} {{ define "main" }}
{{ partial "single_main.html" . }} {{ partial "single_main.html" . }}
{{ end }} {{ end }}
@ -27,7 +23,3 @@
<script defer {{ if $isModule }}type="module"{{ end }} src="{{ $script.Permalink | relURL }}"></script> <script defer {{ if $isModule }}type="module"{{ end }} src="{{ $script.Permalink | relURL }}"></script>
{{- end -}} {{- end -}}
{{ end }} {{ end }}
{{ define "footer" }}
{{ partial "footer.html" . }}
{{ end }}

View file

@ -1,16 +1,18 @@
{{ define "main" }} {{ define "body" }}
<div class="platter grid"> <main>
<h1 class="site">{{ .Title }}</h1> <div class="platter grid">
<div id="content"> <h1 class="site">{{ .Title }}</h1>
{{ .Content }} <div id="content">
</div> {{ .Content }}
{{- with site.Menus.main -}} </div>
{{- with site.Menus.main -}}
{{- $url := $.RelPermalink -}} {{- $url := $.RelPermalink -}}
<nav class="site bulleted"> <nav class="site bulleted">
{{- range . -}} {{- range . -}}
<li><a class="{{ if eq .URL $url }}active{{ end }}" href="{{ .URL }}"><span>{{ i18n .Identifier | default .Name }}</span></a></li> <li><a class="{{ if eq .URL $url }}active{{ end }}" href="{{ .URL }}"><span>{{ i18n .Identifier | default .Name }}</span></a></li>
{{- end -}} {{- end -}}
</nav> </nav>
{{ end }} {{ end }}
</div> </div>
</main>
{{ end }} {{ end }}