feat: support leaf bundles for blog posts, refactor header images
This commit is contained in:
@@ -40,12 +40,7 @@
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<div class="blogpost">
|
||||
{{ if isset .Params "headerimage" }}
|
||||
<div class="header-image">
|
||||
<img src="/img/{{ .Params.headerImage }}" />
|
||||
<p>{{ with .Params.headercredits }}{{ . | markdownify }}{{ end }}</p>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ partial "blog/headerimage" . }}
|
||||
{{ .Content }}
|
||||
<!-- only show related posts if param is true, or if it's not a page -->
|
||||
{{ if or (eq .Params.related true) (ne .Params.page true) }}
|
||||
@@ -85,6 +80,6 @@
|
||||
|
||||
<!-- Matomo -->
|
||||
{{ partial "matomo" . }}
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
15
themes/hugo-sustain/layouts/partials/blog/headerimage.html
Normal file
15
themes/hugo-sustain/layouts/partials/blog/headerimage.html
Normal file
@@ -0,0 +1,15 @@
|
||||
{{- $page := . -}}
|
||||
{{- with $page.Params.headerimage }}
|
||||
<div class="header-image">
|
||||
{{- if eq $page.BundleType "leaf" }}
|
||||
{{- with $page.Resources.GetMatch .src }}
|
||||
<img src="{{ .RelPermalink }}" />
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- with resources.GetMatch (printf "**/%s" .src) }}
|
||||
<img src="{{ .RelPermalink }}" />
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .text }}<p>{{ . | markdownify }}</p>{{ end }}
|
||||
</div>
|
||||
{{- end }}
|
||||
Reference in New Issue
Block a user