make dateFormat configurable

This commit is contained in:
kentnek 2020-06-23 23:20:02 +08:00
parent 9c1b6ac916
commit 1004a391df
5 changed files with 14 additions and 4 deletions

View File

@ -1,3 +1,6 @@
@import "colors";
@import "vars";
.post-list__container {
margin: 0 auto;
max-width: 1200px;

View File

@ -15,6 +15,8 @@ themesDir = "../../"
# Optional params
[params]
dateFormat = "Jan 2 2006"
# Links to your social accounts, comment/uncomment as needed. Icons will be displayed for those specified.
twitter = "https://twitter.com/<your handle>"
github = "https://github.com/<your handle>"

View File

@ -3,6 +3,8 @@
{{ end }}
{{ define "main" }}
{{ $dateFormat := .Site.Params.dateFormat | default "Jan 2 2006" }}
<div class="post-list__container">
<ul class="post-list">
@ -10,8 +12,7 @@
<li class="post">
<div class="post__header">
<time class="post__date" datetime="{{ .Date }}"
>{{ .Date.Format "Jan 2 2006" }}</time
>
>{{ .Date.Format $dateFormat }}</time>
<h2 class="post__title">
<a href="{{.RelPermalink}}">{{ .Title }}</a>
</h2>

View File

@ -3,11 +3,13 @@
{{ end }}
{{ define "main" }}
{{ $dateFormat := .Site.Params.dateFormat | default "Jan 2 2006" }}
<div class="post">
<header class="post__header">
<h1 class="post__title">{{.Title}}</h1>
<time datetime="{{ .Date }}" class="post__date"
>{{ .Date.Format "Jan 2 2006" }}</time
>{{ .Date.Format $dateFormat }}</time
>
</header>
<article class="post__content">

View File

@ -3,6 +3,8 @@
{{ end }}
{{ define "main" }}
{{ $dateFormat := .Site.Params.dateFormat | default "Jan 2 2006" }}
<div class="post-list__container">
<div class="tag__header">
<a href="/blog">All posts</a><span class="separator">/</span>
@ -12,7 +14,7 @@
{{ range .Data.Pages }}
<li class="post">
<div class="post__header">
<time class="post__date" datetime="{{ .Date }}">{{ .Date.Format "Jan 2 2006" }}</time>
<time class="post__date" datetime="{{ .Date }}">{{ .Date.Format $dateFormat }}</time>
<h2 class="post__title">
<a href="{{.RelPermalink}}">{{ .Title }}</a>
</h2>