-
Notifications
You must be signed in to change notification settings - Fork 442
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract common article info footer into an include
The article info footer (article date, "x minute read", and tags) occur in three places (article list, article view, and articles-by-tag). This commit deduplicates the redundant code from these three places into a single include.
- Loading branch information
1 parent
9a05590
commit 5037395
Showing
4 changed files
with
24 additions
and
58 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<div class="article-list-footer"> | ||
<span class="article-list-date"> | ||
{{ include.post.date | date: "%B %-d, %Y" }} | ||
</span> | ||
<span class="article-list-divider">-</span> | ||
<span class="article-list-minutes"> | ||
{% capture words %} | ||
{{ include.post.content | number_of_words }} | ||
{% endcapture %} | ||
{% unless words contains "-" %} | ||
{{ words | plus: 250 | divided_by: 250 | append: " minute read" }} | ||
{% endunless %} | ||
</span> | ||
<span class="article-list-divider">-</span> | ||
<div class="article-list-tags"> | ||
{% for tag in include.post.tags %} | ||
{% assign tag_name = site.my_tags | where: "slug", tag | map: "name" | first %} | ||
<a href="{{ 'tag/' | relative_url }}{{ tag }}" title="See all posts with tag '{{ tag_name }}'">{{ tag_name }}</a> | ||
{% endfor %} | ||
</div> | ||
</div> |
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