Files

29 lines
1.0 KiB
HTML

{{/* section
label: Cards
about: A grid of cards, written here or taken from a file in data/.
fields:
- { name: heading, type: text }
- { name: intro, type: markdown }
- name: items
type: list
help: The cards. Leave empty to use a data file instead.
fields:
- { name: title, type: text, required: true }
- { name: text, type: markdown }
- { name: href, type: link, label: Links to }
- { name: from, type: data, label: Cards from, help: A file in data/ that holds the cards. }
*/}}
{{ $items := .Data.items }}{{ with .Data.from }}{{ $items = data . }}{{ end }}
<section class="block">
<div class="wrap">
{{ with .Data.heading }}<h2>{{ . }}</h2>{{ end }}
{{ with .Data.intro }}<div class="intro">{{ markdownify . }}</div>{{ end }}
<ul class="cards">
{{ range $items }}<li class="card">
<h3>{{ if .href }}<a href="{{ .href }}">{{ .title }}</a>{{ else }}{{ .title }}{{ end }}</h3>
{{ with .text }}{{ markdownify . }}{{ end }}
</li>{{ end }}
</ul>
</div>
</section>