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 }} date: {{ .Date }}
author: author:
draft: false draft: false
weight: 10 weight: 50
--- ---
### First Headline ### First Headline

View file

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

View file

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

View file

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

View file

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