Skip to content

Commit 96c2508

Browse files
bangjunyoungdaattali
authored andcommitted
Add support for customizable date format (daattali#533)
* Add support for customizable date format * Add support for customizable date format
1 parent e58cd52 commit 96c2508

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

_config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,9 @@ excerpt_length: 50
150150
# and RSS feed title
151151
title-separator: "-"
152152

153+
# Ruby Date Format
154+
date_format: "%B %-d, %Y"
155+
153156
# --- Don't need to touch anything below here (but you can if you want) --- #
154157

155158
# Output options (more information on Jekyll's site)

_includes/header.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ <h2 class="{{ include.type }}-subheading">{{ page.subtitle }}</h2>
3636
{% endif %}
3737

3838
{% if include.type == "post" %}
39-
<span class="post-meta">Posted on {{ page.date | date: "%B %-d, %Y" }}</span>
39+
<span class="post-meta">Posted on {{ page.date | date: site.date_format }}</span>
4040
{% endif %}
4141
</div>
4242
</div>
@@ -61,7 +61,7 @@ <h2 class="{{ include.type }}-subheading">{{ page.subtitle }}</h2>
6161
{% endif %}
6262

6363
{% if include.type == "post" %}
64-
<span class="post-meta">Posted on {{ page.date | date: "%B %-d, %Y" }}</span>
64+
<span class="post-meta">Posted on {{ page.date | date: site.date_format }}</span>
6565
{% endif %}
6666
</div>
6767
</div>

tags.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ <h2 id="{{- tag -}}" class="linked-section">
2525
<div class="tag-entry">
2626
<a href="{{ post.url | relative_url }}">{{- post.title -}}</a>
2727
<div class="entry-date">
28-
<time datetime="{{- post.date | date_to_xmlschema -}}">{{- post.date | date: "%B %d, %Y" -}}</time>
28+
<time datetime="{{- post.date | date_to_xmlschema -}}">{{- post.date | date: site.date_format -}}</time>
2929
</div>
3030
</div>
3131
{%- endfor -%}

0 commit comments

Comments
 (0)