add special 'cards' (i.e. zettel) layout

This commit is contained in:
Helmut Merz 2023-10-25 11:48:22 +02:00
parent 93de6c6a98
commit 67bf21ac6c
2 changed files with 49 additions and 1 deletions

48
layouts/cards/single.html Normal file
View file

@ -0,0 +1,48 @@
{{ define "main" -}}
<div class="row">
{{- $mainwidth := or (and .Params.noSidebar "12") "8" -}}
<div class="col-md-{{ $mainwidth }}">
<article class="card mt-3 mb-3"
itemscope itemtype="http://schema.org/BlogPosting">
{{ if .Title -}}
<header class="post-header card-header">
<h2 class="post-title" itemprop="name headline">{{ .Title }}</h2>
{{ if and (not .Params.nodate) .Date -}}
<p class="post-meta">
<time datetime='{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}'
itemprop="datePublished">{{ .Date.Format (i18n "dateFormat") }}</time>
{{ with .Params.Author -}} •
<span itemprop="author" itemscope
itemtype="http://schema.org/Person">
<span itemprop="name">{{ . }}</span></span>
{{- end }}
</p>
{{- end }}
</header>
{{- end }}
{{ with .Content -}}
<div class="post-content card-body" itemprop="articleBody">{{ . }}</div>
{{- end }}
{{- $related := .Site.RegularPages.RelatedTo (keyVals "parents" .Params.pageid) -}}
{{ range sort (sort $related "Date" "desc") "Weight" }}
<div class="card-body">
<h3 class="post-title" itemprop="name headline">{{ .Title }}</h3>
{{ with .Content -}}
<div itemprop="articleBody">{{ . }}</div>
{{- end }}
</div>
{{ end }}
</article>
</div>
{{ if not .Params.noSidebar -}}
{{ partial "sidebar.html" . }}
{{- end }}
</div>
{{- end }}

View file

@ -22,7 +22,7 @@
{{- if $refPage -}} {{- if $refPage -}}
<a href="{{ $refPage.Permalink }}"><img <a href="{{ $refPage.Permalink }}"><img
src="{{ $image.RelPermalink }}" alt="{{ or $alt $refPage.Title }}" src="{{ $image.RelPermalink }}" alt="{{ or $alt $refPage.Title }}"
class="{{ $class }}"></a> class="{{ $class }}"></a>
{{- else -}} {{- else -}}
<img src="{{ $image.RelPermalink }}" alt="{{ $alt }}" class="{{ $class }}"> <img src="{{ $image.RelPermalink }}" alt="{{ $alt }}" class="{{ $class }}">
{{- end -}} {{- end -}}