Skip to content

Commit

Permalink
fix: date on post is not following dateFormat (#234)
Browse files Browse the repository at this point in the history
* Use dateFormat option instead of postDateFormat

---------

Co-authored-by: Laborratte5 <[email protected]>
  • Loading branch information
Laborratte5 and Laborratte5 authored Sep 26, 2024
1 parent 588ad28 commit c95d246
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
<article>
<header class="header">
<h1 class="header-title">{{ .Title }}</h1>
{{ $configDateFormat := .Site.Params.dateFormat | default ":date_medium" }}
{{ with .Date }}
{{ $ISO_time := dateFormat "2006-01-02T15:04:05-07:00" . }}
<div class="post-meta">
<time datetime="{{ $ISO_time }}" itemprop="datePublished"> {{ . | time.Format ":date_medium" }} </time>
<time datetime="{{ $ISO_time }}" itemprop="datePublished"> {{ . | time.Format $configDateFormat }} </time>
</div>
{{ end }}
</header>
Expand Down

0 comments on commit c95d246

Please sign in to comment.