38 lines
1.6 KiB
HTML
38 lines
1.6 KiB
HTML
{{- /* Renders the project cards on the landing page from data/projects.yaml.
|
|||
|
|
Validates the data so a broken entry fails the build instead of shipping
|
||
|
|
an empty card. Styling lives in layouts/_partials/extend_head.html. */ -}}
|
||
|
|
|
||
|
|
{{- with hugo.Data.projects -}}
|
||
|
|
<section id="projekte" class="projects">
|
||
|
|
<h2>Projekte</h2>
|
||
|
|
<div class="project-grid">
|
||
|
|
{{- range $project := . }}
|
||
|
|
{{- if or (not $project.name) (not $project.url) (not $project.description) }}
|
||
|
|
{{- errorf "data/projects.yaml: entry %q needs name, url and description" (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 }}
|
||
|
|
<article class="project-card">
|
||
|
|
<header class="project-header">
|
||
|
|
<h3><a href="{{ $project.url }}">{{ $project.name }}</a></h3>
|
||
|
|
{{- with $project.status }}
|
||
|
|
<span class="project-status">{{ . }}</span>
|
||
|
|
{{- end }}
|
||
|
|
</header>
|
||
|
|
<p class="project-description">{{ $project.description }}</p>
|
||
|
|
{{- with $project.tags }}
|
||
|
|
<ul class="project-tags">
|
||
|
|
{{- range . }}
|
||
|
|
<li>{{ . }}</li>
|
||
|
|
{{- end }}
|
||
|
|
</ul>
|
||
|
|
{{- end }}
|
||
|
|
<a class="project-link" href="{{ $project.url }}">Projekt ansehen →</a>
|
||
|
|
</article>
|
||
|
|
{{- end }}
|
||
|
|
</div>
|
||
|
|
</section>
|
||
|
|
{{- else -}}
|
||
|
|
{{- errorf "data/projects.yaml is missing or empty" -}}
|
||
|
|
{{- end -}}
|