Skip to content

Commit

Permalink
Add clever variable dates in footer
Browse files Browse the repository at this point in the history
  • Loading branch information
georgewatson committed Apr 9, 2020
1 parent fa29481 commit 63a5e5f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
14 changes: 13 additions & 1 deletion _includes/footer.html
Expand Up @@ -6,7 +6,12 @@
<a rel="license"
href="https://creativecommons.org/licenses/by/4.0/">CC-BY</a>/<a
href="/LICENSE">MIT</a>
{{ site.time | date: '%Y' }}
{% assign site_age = site.git.first_commit.commit_date | date: '%Y' %}
{% assign page_age = page.git.last_commit.commit_date | date: '%Y' %}
{{ site_age }}
{%- if site_age != page_age -%}
&ndash;{{ page_age }}
{% endif %}
<span xmlns:cc="http://creativecommons.org/ns#"
data-url="{{site.url}}{{page.url}}"
property="cc:attributionName"
Expand All @@ -18,9 +23,16 @@
href="https://github.com/georgewatson/georgewatson.me/commit/{{ site.git.last_commit.long_sha }}"
title="{{ site.git.last_commit.message }}"
>{{ site.git.last_commit.short_sha }}</a>
<small>({{ site.git.last_commit.commit_date | date: '%F' }})</small>
&bull;
<i class="fas fa-user-secret"></i>
<a href="/privacy_policy">Privacy policy</a>
{% assign pages_list = (site.pages | sort: 'order') %}
{%- for node in pages_list -%}
{% if node.title contains 'Privacy' %}
<small>({{ node.git.last_commit.commit_date | date: '%F' }})</small>
{% endif %}
{%- endfor -%}
</p>
<p>
<i class="fas fa-palette"></i>
Expand Down
7 changes: 4 additions & 3 deletions _includes/related_posts.html
Expand Up @@ -9,7 +9,8 @@ <h2>Related posts</h2>
{%- assign minTags = 2 -%}

{% comment %}
Probably don't play with anything after this point
Probably don't play with anything after this point,
except that you may wish to reduce maxTags if compilation is slow
{% endcomment %}
{%- assign maxTags = page.tags | size -%}
{%- assign relatedCount = 0 -%}
Expand Down Expand Up @@ -38,7 +39,7 @@ <h2>Related posts</h2>
{%- for numTags in (minTags..maxTags) reversed -%}
{%- for post in site.posts -%}
{%- unless page.related contains post.url -%}
{%- if relatedCount < maxRelated and page.url != post.url -%}
{%- if relatedCount < maxRelated and page.id != post.id -%}
{%- assign sharedTags = 0 -%}
{%- for tag in post.tags -%}
{%- if page.tags contains tag -%}
Expand All @@ -65,7 +66,7 @@ <h2>Related posts</h2>
{%- if relatedCount < maxRelated -%}
{%- for post in site.posts -%}
{%- unless page.related contains post.url -%}
{%- if relatedCount < maxRelated and page.url != post.url and page.category == post.category -%}
{%- if relatedCount < maxRelated and page.id != post.id and page.category == post.category -%}
{%- assign sharedTags = 0 -%}
{%- for tag in post.tags -%}
{%- if page.tags contains tag -%}
Expand Down

0 comments on commit 63a5e5f

Please sign in to comment.