minor improvements for cards; avoid linefeeds in Go template code

This commit is contained in:
Helmut Merz 2020-07-25 19:11:32 +02:00
parent b3127efd25
commit bc760b6175
5 changed files with 26 additions and 14 deletions

View file

@ -8,7 +8,7 @@ topics: []
date: {{ .Date }}
author:
draft: false
weight: 10
weight: 50
---
### First Headline

View file

@ -5,6 +5,9 @@
about:
other: Über uns
articles:
other: Artikel
author:
other: Autor

View file

@ -5,6 +5,9 @@
about:
other: About
articles:
other: Articles
author:
other: Author
@ -27,6 +30,12 @@ domain:
next:
other: Next
pages:
other: Pages
posts:
other: Posts
prev:
other: Previous

View file

@ -10,13 +10,13 @@
<p class="post-meta">
<time datetime='{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}'
itemprop="datePublished">{{ .Date.Format (i18n "dateFormat") }}</time>
{{ with .Params.Author }} •
{{ with .Params.Author -}} •
<span itemprop="author" itemscope
itemtype="http://schema.org/Person">
<span itemprop="name">{{ . }}</span></span>
{{- end }}
</p>
{{ end }}
{{- end }}
</header>
<div class="post-content card-body" itemprop="articleBody">

View file

@ -1,43 +1,43 @@
<div class="col-md-4 mt20">
{{ if .Params.img }}
{{ if .Params.img -}}
<img width="100%" class="mt-3"
src="{{ .Site.BaseURL}}img/{{ .Params.img }}" alt="{{ .Params.title }}">
{{ else if .Params.teaser }}
{{- else if .Params.teaser -}}
<div class="card mt-3">
<div class="card-body bg-light">
<h5 class="card-text">{{ .Params.teaser }}</h5>
</div>
</div>
{{ else if .Site.Params.defaultImage }}
{{- else if .Site.Params.defaultImage -}}
<img width="100%" class="mt-3"
src="{{ .Site.BaseURL }}img/{{ .Site.Params.defaultImage }}" alt="dummy">
{{ end }}
{{- end }}
{{ $site := .Site }}
{{ with .Params.Topics }}
{{- $site := .Site -}}
{{ with .Params.Topics -}}
<div class="card mt-3">
<div class="card-header">
<h4 class="card-text">{{i18n "topics"}}</h4>
</div>
<div class="card-body">
<ul id="topics" class="list-inline">
{{ range . }}
{{ range . -}}
{{ $page := $site.GetPage (printf "/topics/%s" .) }}
<li><a href="{{ $page.Permalink }}">{{ $page.Title }}</a> </li>
{{ end }}
{{- end }}
</ul>
</div>
</div>
{{ end }}
{{- end }}
<div class="card mt-3">
{{- $section := or .Section "posts" -}}
<div class="card-header">
<h4 class="card-text">{{i18n "recentArticles"}}</h4>
<h4 class="card-text">{{i18n $section}}</h4>
</div>
<div class="card-body">
<ul class="list-inline">
{{ $section := or .Section "posts" }}
{{ range first 20 (where .Site.RegularPages "Section" $section) }}
<li>
<a href="{{ .Permalink }}"