diff options
author | Ryan Robeson <ryan.robeson@gmail.com> | 2017-06-07 03:57:25 +0300 |
---|---|---|
committer | Ryan Robeson <ryan.robeson@gmail.com> | 2017-06-07 03:57:25 +0300 |
commit | af57cec853c5e840207ad8e000886f0c778205ad (patch) | |
tree | 325a400d72cc8da80a737bc4d9f6d4d700a00048 | |
parent | 0c3da68b8e1cc9b7616c977aab34d7cd7e283da9 (diff) |
Add a default .Site.Params.DateForm value
When lanyon-hugo is used as a theme (cloned into the themes/ directory)
rather than a standalone starter template, its config is ignored.
This meant that sites that didn't set DateForm in their config failed to
build. See #2 and #17.
Now, if DateForm isn't specified in the config, it will default to "Jan
2, 2006".
-rw-r--r-- | layouts/_default/li.html | 2 | ||||
-rw-r--r-- | layouts/_default/single.html | 2 | ||||
-rwxr-xr-x | layouts/index.html | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/layouts/_default/li.html b/layouts/_default/li.html index 7f59bb1..2003dea 100644 --- a/layouts/_default/li.html +++ b/layouts/_default/li.html @@ -1 +1 @@ -<li>{{ .Date.Format .Site.Params.DateForm }} - <a href="{{ .Permalink }}">{{ .Title }}</a></li> +<li>{{ .Site.Params.DateForm | default "Jan 2, 2006" | .Date.Format }} - <a href="{{ .Permalink }}">{{ .Title }}</a></li> diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 526ed57..81fab20 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -2,7 +2,7 @@ <div class="post"> <h1 class="post-title">{{ .Title }}</h1> - <span class="post-date">{{ .Date.Format .Site.Params.DateForm }}</span> + <span class="post-date">{{ .Site.Params.DateForm | default "Jan 2, 2006" | .Date.Format }}</span> {{ .Content }} </div> diff --git a/layouts/index.html b/layouts/index.html index dfb3889..2475182 100755 --- a/layouts/index.html +++ b/layouts/index.html @@ -7,7 +7,7 @@ {{ range .Paginator.Pages }} <div class="post"> <h1 class="post-title"><a href="{{ .Permalink }}">{{ .Title }}</a></h1> - <span class="post-date">{{ .Date.Format .Site.Params.DateForm }}</span> + <span class="post-date">{{ .Site.Params.DateForm | default "Jan 2, 2006" | .Date.Format }}</span> {{ .Content }} </div> {{ end }} |