-
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ feat: allow dual date-format (short/long)
- Loading branch information
Showing
9 changed files
with
92 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{% macro cards_pages(pages) %} | ||
|
||
<div class="cards"> | ||
{%- for page in pages %} | ||
<div class="card"> | ||
{% if page.extra.local_image %} | ||
<img class="card-image" alt={{ page.extra.local_image }} src="{{ get_url(path=page.extra.local_image) }}"> | ||
{% elif page.extra.remote_image %} | ||
<img class="card-image" alt={{ page.extra.remote_image }} src="{{ page.extra.remote_image }}"> | ||
{% else %} | ||
<div class="card-image-placeholder"></div> | ||
{% endif %} | ||
|
||
<div class="card-info"> | ||
<h1 class="card-title"> | ||
{% if page.extra.link_to %} | ||
<a rel="noopener noreferrer" target="_blank" href={{ page.extra.link_to }}>{{page.title}}</a> | ||
{% else %} | ||
<a href={{ page.permalink }}>{{page.title}}</a> | ||
{% endif %} | ||
</h1> | ||
|
||
<div class="meta"> | ||
{% if page.date %} | ||
{{ macros_format_date::format_date(date=page.date, short=false) }} | ||
{% endif %} | ||
{% if page.draft %} | ||
<span class="draft-label">DRAFT</span> | ||
{% endif %} | ||
</div> | ||
|
||
<div class="card-description"> | ||
{% if page.description %} | ||
{{ page.description }} | ||
{% endif %} | ||
</div> | ||
</div> | ||
</div> | ||
|
||
{% endfor -%} | ||
</div> | ||
|
||
{% endmacro cards_pages %} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{% macro format_date(date, short) %} | ||
|
||
{% if config.extra.short_date_format %} | ||
{{ date | date(format=config.extra.short_date_format) }} | ||
{% elif config.extra.long_date_format %} | ||
{{ date | date(format=config.extra.long_date_format) }} | ||
{% else %} | ||
{% set day = date | date(format='%-d') | int %} | ||
|
||
{% if day in [11, 12, 13] %} | ||
{% set suffix = "th" %} | ||
{% else %} | ||
{% set last_digit = day % 10 %} | ||
{% if last_digit == 1 %} | ||
{% set suffix = "st" %} | ||
{% elif last_digit == 2 %} | ||
{% set suffix = "nd" %} | ||
{% elif last_digit == 3 %} | ||
{% set suffix = "rd" %} | ||
{% else %} | ||
{% set suffix = "th" %} | ||
{% endif %} | ||
{% endif %} | ||
|
||
{# Return the date. #} | ||
{% if short == true %} | ||
{{ date | date(format="%-d") }}{{ suffix }} {{ date | date(format="%b %Y") }} | ||
{% else %} | ||
{{ date | date(format="%-d") }}{{ suffix }} {{ date | date(format="%B %Y") }} | ||
{% endif %} | ||
{% endif %} | ||
|
||
{% endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters