2026-11-07 08:04:31 +01:00
|
|
|
{{- /* Renders the project entries on the landing page from data/projects.yaml.
|
2026-11-06 10:40:48 +01:00
|
|
|
Validates the data so a broken entry fails the build instead of shipping
|
2026-11-07 08:04:31 +01:00
|
|
|
an empty card. Images live in assets/ and are resized by Hugo.
|
|
|
|
|
Styling lives in layouts/_partials/extend_head.html. */ -}}
|
2026-11-06 10:40:48 +01:00
|
|
|
|
|
|
|
|
{{- with hugo.Data.projects -}}
|
|
|
|
|
<section id="projekte" class="projects">
|
|
|
|
|
<h2>Projekte</h2>
|
2026-11-07 08:04:31 +01:00
|
|
|
{{- range $project := . }}
|
|
|
|
|
{{- if or (not $project.name) (not $project.url) (not $project.description) (not $project.image) }}
|
|
|
|
|
{{- errorf "data/projects.yaml: entry %q needs name, url, description and image" (default "<unnamed>" $project.name) }}
|
|
|
|
|
{{- end }}
|
|
|
|
|
{{- if not (hasPrefix $project.url "http") }}
|
|
|
|
|
{{- errorf "data/projects.yaml: %q must use an absolute http(s) url, got %q" $project.name $project.url }}
|
|
|
|
|
{{- end }}
|
|
|
|
|
{{- $image := resources.Get $project.image }}
|
|
|
|
|
{{- if $image }}
|
|
|
|
|
{{- $image = $image.Resize "800x webp" }}
|
|
|
|
|
{{- else }}
|
|
|
|
|
{{- errorf "data/projects.yaml: image %q for %q does not exist under assets/" $project.image $project.name }}
|
|
|
|
|
{{- end }}
|
|
|
|
|
<article class="project">
|
|
|
|
|
<figure class="project-media">
|
|
|
|
|
{{- with $image }}
|
|
|
|
|
<a href="{{ $project.url }}" tabindex="-1" aria-hidden="true">
|
|
|
|
|
<img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}"
|
|
|
|
|
alt="{{ $project.image_alt | default $project.name }}" loading="lazy" decoding="async">
|
|
|
|
|
</a>
|
|
|
|
|
{{- end }}
|
|
|
|
|
{{- with $project.image_credit }}
|
|
|
|
|
<figcaption>{{ . }}</figcaption>
|
|
|
|
|
{{- end }}
|
|
|
|
|
</figure>
|
|
|
|
|
<div class="project-body">
|
2026-11-06 10:40:48 +01:00
|
|
|
<header class="project-header">
|
|
|
|
|
<h3><a href="{{ $project.url }}">{{ $project.name }}</a></h3>
|
|
|
|
|
{{- with $project.status }}
|
|
|
|
|
<span class="project-status">{{ . }}</span>
|
|
|
|
|
{{- end }}
|
|
|
|
|
</header>
|
2026-11-07 08:04:31 +01:00
|
|
|
<div class="project-text">
|
|
|
|
|
{{- $.Page.RenderString (dict "display" "block") $project.description -}}
|
|
|
|
|
</div>
|
2026-11-06 10:40:48 +01:00
|
|
|
{{- with $project.tags }}
|
|
|
|
|
<ul class="project-tags">
|
|
|
|
|
{{- range . }}
|
|
|
|
|
<li>{{ . }}</li>
|
|
|
|
|
{{- end }}
|
|
|
|
|
</ul>
|
|
|
|
|
{{- end }}
|
2026-11-07 08:04:31 +01:00
|
|
|
<footer class="project-footer">
|
|
|
|
|
<a class="project-link" href="{{ $project.url }}">Projekt ansehen →</a>
|
|
|
|
|
</footer>
|
|
|
|
|
</div>
|
|
|
|
|
</article>
|
|
|
|
|
{{- end }}
|
2026-11-06 10:40:48 +01:00
|
|
|
</section>
|
|
|
|
|
{{- else -}}
|
|
|
|
|
{{- errorf "data/projects.yaml is missing or empty" -}}
|
|
|
|
|
{{- end -}}
|