From b79cb616ea66819e065a436dec7ac8ef8c5034e0 Mon Sep 17 00:00:00 2001
From: Luiz de PrĂ¡ <rawarkanis@gmail.com>
Date: Fri, 14 Sep 2018 13:11:27 +0000
Subject: [PATCH] Add dateformat config

---
 exampleSite/config.toml    |    2 ++
 layouts/partials/post.html |    6 +++---
 layouts/partials/list.html |    2 +-
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index 0a0f3fb..e3d93b4 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -22,6 +22,8 @@
     avatarurl = "images/avatar.jpg"
     footercontent = "Enter a text here."
 
+    dateformat = "January 2, 2006"
+
     hideCredits = false
     hideCopyright = false
 
diff --git a/layouts/partials/list.html b/layouts/partials/list.html
index f62516b..300ea6a 100644
--- a/layouts/partials/list.html
+++ b/layouts/partials/list.html
@@ -3,7 +3,7 @@
   <ul>
     {{ range .Paginator.Pages }}
     <li>
-      <span>{{ .Date.Format "January 2, 2006" }}</span><a href="{{ .URL }}">{{ .Title }}</a>
+      <span>{{ .Date.Format (.Site.Params.dateFormat | default "January 2, 2006" ) }}</span><a href="{{ .URL }}">{{ .Title }}</a>
     </li>
     {{ end }}
   </ul>
diff --git a/layouts/partials/post.html b/layouts/partials/post.html
index a48aeed..e4eed5f 100644
--- a/layouts/partials/post.html
+++ b/layouts/partials/post.html
@@ -2,7 +2,7 @@
   <article>
     <header>
       <h1 class="title">{{ .Title }}</h1>
-      <h2 class="date">{{ .Date.Format "January 2, 2006" }}</h2>
+      <h2 class="date">{{ .Date.Format (.Site.Params.dateFormat | default "January 2, 2006" ) }}</h2>
 
       {{ if eq .Params.math "true" }}
         <script type="text/javascript" async
@@ -38,5 +38,5 @@
   {{ if and (not (eq .Site.DisqusShortname "" )) (eq (.Params.disable_comments | default false) false)}}
       {{ template "_internal/disqus.html" . }}
   {{ end }}
-  
-</section>
\ No newline at end of file
+
+</section>

--
Gitblit v1.10.0