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:
parent
1a548d3567
commit
f7fbd1e7f2
4 changed files with 5 additions and 6 deletions
|
|
@ -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">
|
||||
|
|
|
|||
|
|
@ -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">
|
||||
|
|
|
|||
2
layouts/partials/author-date.html
Normal file
2
layouts/partials/author-date.html
Normal 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>
|
||||
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Reference in a new issue