Skip to content

Commit

Permalink
Add support for customizable date format (daattali#533)
Browse files Browse the repository at this point in the history
* Add support for customizable date format

* Add support for customizable date format
  • Loading branch information
bangjunyoung authored and Matt Erickson committed Apr 22, 2020
1 parent 48f8a9d commit e9342de
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
3 changes: 3 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ excerpt_length: 95
# and RSS feed title
title-separator: "-"

# Ruby Date Format
date_format: "%B %-d, %Y"

# --- Don't need to touch anything below here (but you can if you want) --- #

# Output options (more information on Jekyll's site)
Expand Down
10 changes: 4 additions & 6 deletions _includes/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,9 @@ <h2 class="{{ include.type }}-subheading">{{ page.subtitle }}</h2>
{% endif %}
{% endif %}

{% if page.date %}
{% if include.type == "post" %}
<span class="post-meta">Posted on {{ page.date | date: "%B %-d, %Y" }}</span>
{% endif %}
{% endif %}
{% if include.type == "post" %}
<span class="post-meta">Posted on {{ page.date | date: site.date_format }}</span>
{% endif %}
</div>
</div>
</div>
Expand All @@ -63,7 +61,7 @@ <h2 class="{{ include.type }}-subheading">{{ page.subtitle }}</h2>
{% endif %}

{% if include.type == "post" %}
<span class="post-meta">Posted on {{ page.date | date: "%B %-d, %Y" }}</span>
<span class="post-meta">Posted on {{ page.date | date: site.date_format }}</span>
{% endif %}
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion tags.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ <h2 id="{{- tag -}}" class="linked-section">
<div class="tag-entry">
<a href="{{ post.url | relative_url }}">{{- post.title -}}</a>
<div class="entry-date">
<time datetime="{{- post.date | date_to_xmlschema -}}">{{- post.date | date: "%B %d, %Y" -}}</time>
<time datetime="{{- post.date | date_to_xmlschema -}}">{{- post.date | date: site.date_format -}}</time>
</div>
</div>
{%- endfor -%}
Expand Down

0 comments on commit e9342de

Please sign in to comment.