Move author and date information for post to common partials

To remove code duplication, let's move this to a partial and
reuse it.
This commit is contained in:
Frieder Schrempf 2020-12-28 11:14:39 +01:00
commit f7fbd1e7f2
No known key found for this signature in database
GPG key ID: E7DD51F45F833802
4 changed files with 5 additions and 6 deletions

View file

@ -4,8 +4,7 @@
<header>
<h1 class="hidden">{{ .Title }}</h1>
<p>
{{ with $.Param "author" }}<span class="author">{{ . }}</span> – {{ end -}}
<time class="created-date" datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format ($.Param "dateformat" | default "2 January, 2006") }}</time>
{{ partial "author-date" . }}
</p>
</header>
<div class="content">

View file

@ -2,8 +2,7 @@
<header>
<h2 class="hidden">{{ .Title }}</h2>
<p><a href="{{ .RelPermalink }}">
{{ with $.Param "author" }}<span class="author">{{ . }}</span> – {{ end -}}
<time class="created-date" datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format ($.Param "dateformat" | default "2 January, 2006") }}</time>
{{ partial "author-date" . }}
</a></p>
</header>
<div class="content">

View file

@ -0,0 +1,2 @@
{{ with $.Param "author" }}<span class="author" itemprop="author">{{ . }}</span> – {{ end -}}
<time class="created-date" datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format ($.Param "dateformat" | default "2 January, 2006") }}</time>

View file

@ -1,4 +1,3 @@
<div class="submitted">
{{ with $.Param "author" }}<span class="author" itemprop="author">{{ . }}</span> – {{ end -}}
<time class="created-date" datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format ($.Param "dateformat" | default "2 January, 2006") }}</time>
{{ partial "author-date" . }}
</div>