ccchh-website/themes/ccchh/layouts/index.html
jtbx e4ff96aee2 Add shortcode to place resized images + fix md image for non-pagebundles
If a page is not a page bundle, it can't access files in the same
directory via the .Resources variable. So we need to detect this
condition and get the image file in another way.
2023-10-11 23:29:06 +02:00

44 lines
1.3 KiB
HTML

{{ define "main" }}
<main class="container" aria-role="main">
<div class="homepage-content">
{{ .Content }}
</div>
{{- $events := where (.Site.GetPage "blog").Pages ".Params.categories" "event" }}
{{- $upcoming := where $events ".Params.date" "ge" now }}
{{ if $upcoming }}
<div class="announcements">
<h2>Neuigkeiten</h2>
{{- range $upcoming.ByDate }}
<div class="announcement">
{{- partial "blog-header.html" (dict "headingLink" true "level" 4 "reduced" true "page" . ) }}
{{- if in .RawContent "<!--more-->" }}
{{ .Summary | safeHTML }}
{{- else }}
<p>{{ .Summary | safeHTML }}</p>
{{- end }}
</div>
{{- end }}
</div>
{{- end }}
{{- $home_sections := .Site.GetPage "/home" }}
{{- range sort ($home_sections.Resources.Match "*.md") ".Name" }}
<div class="section">
<h2>{{ .Title }}</h2>
{{ .Content -}}
{{- with .Params.Resources }}
<div class="flex-grid">
{{- range . }}
{{- $img := $home_sections.Resources.GetMatch (printf "%s" .src) }}
<div class="img-link"><a href="{{ .params.url }}"><img src="{{ $img.Permalink }}" class="box-image" alt=""></a></div>
{{- end }}
</div>
{{- end }}
</div>
{{ end }}
</main>
{{ end }}