use common *.baseof.html templates

This commit is contained in:
Ben Goldsworthy 2025-06-06 17:01:20 +02:00
parent 4e67efab84
commit af68a0e22d
No known key found for this signature in database
19 changed files with 486 additions and 408 deletions

View file

@ -1,11 +1,5 @@
{{ define "main-class" }}--section layouts-blog-section{{ end }}
{{ define "main-type" }}{{ .Params.mainType }}{{ end }}
{{ define "footer-scripts" }}
<script src="/js/lazy-images.js"></script>
{{ end }}
{{ define "main-header" }}
<header class="site-content__header">
<h2 class="page-title">
@ -40,8 +34,8 @@
{{ end }}
{{ end }}
</h2>
{{ .Content }}
{{ .Content }}
<nav class="page-header__minor-links">
<ul class="minor-links__categories">
@ -56,6 +50,7 @@
</li>
{{ end }}
</ul>
{{ if eq .Type "blog" }}
{{ with .GetPage "blog/posts" }}
{{ partial "years-list.html" . }}
@ -68,11 +63,11 @@
{{ end }}
{{ define "main-body" }}
{{ if eq .Type "blog" }}
{{ with .GetPage "blog/posts" }}
{{ partial "items-grid.html" . }}
{{ end }}
{{ else }}
{{ partial "items-grid.html" . }}
{{ end }}
{{- if eq .Type "blog" -}}
{{- with .GetPage "blog/posts" -}}
{{- partial "items-grid.html" . -}}
{{- end -}}
{{- else -}}
{{- partial "items-grid.html" . -}}
{{- end -}}
{{ end }}

View file

@ -4,57 +4,7 @@
{{ define "main-class" }}--single layouts-blog-single{{ end }}
{{ define "header-scripts" }}
{{ with .Params.locations }}
<script
id="Map-script"
src="/js/leaflet/leaflet.js"
></script>
{{ end }}
{{ end }}
{{ define "header-styles" }}
{{ with .Params.styles }}
<link
rel="stylesheet"
type="text/css"
href="{{ ( $.Page.Resources.GetMatch "style").RelPermalink }}"
/>
{{ end }}
{{ with .Params.locations }}
<link
rel="stylesheet"
href="/css/leaflet/leaflet.css"
/>
{{ end }}
{{ end }}
{{ define "footer-scripts" }}
{{- partialCached "single/footer-scripts.html" ( dict "pc" . "sc" $ ) . -}}
{{ end }}
{{ define "main-header" }}
{{- partial "single/main-header.html" ( dict "pc" . "sc" $ ) -}}
{{ end }}
{{ define "main-body" }}
<section class="site-content__body">
{{ with .Summary }}
<section
class="article-body__summary"
itemprop="abstract"
>
<h2>Summary</h2>
<p class="p-summary">{{ . }}</p>
</section>
{{ end }}
{{- if ( or .Params.internal_links .Params.external_links ) -}}
{{- partial "single/main-body/links.html" ( dict "pc" . "sc" $ ) -}}
{{- end -}}
{{- partial "single/main-body/content.html" ( dict "pc" . "sc" $ ) -}}
{{ define "main-body-additional" }}
{{ if fileExists ( path.Join $.Page.File.Dir "appendices.md" ) }}
{{- partial "single/main-body/appendices.html" ( dict "pc" . "sc" $ ) -}}
{{ end }}
@ -62,13 +12,4 @@
{{ if fileExists ( path.Join $.Page.File.Dir "corrigendum.md" ) }}
{{- partial "single/main-body/appendices.html" ( dict "pc" . "sc" $ ) -}}
{{ end }}
</section>
{{ with .Page.Resources.Get "comments.md" }}
{{- partial "single/main-body/comments.html" ( dict "pc" . "sc" $ ) -}}
{{ end }}
{{ end }}
{{ define "main-footer" }}
{{ partial "single/post-meta.html" ( dict "pc" . "sc" $ ) }}
{{ end }}