Skip to content

Commit

Permalink
Last mod in footer
Browse files Browse the repository at this point in the history
  • Loading branch information
mporcheron authored Aug 28, 2024
1 parent 4cd8f86 commit f86a78b
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 28 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ gem 'nokogiri'
# If you have any plugins, put them here!
group :jekyll_plugins do
gem "jekyll-datapage-generator", "~> 1.4.0"
gem "jekyll-last-commit", :git => "https://github.com/mporcheron/jekyll-last-commit.git"
gem "jekyll-feed"
gem "jekyll-menus", :git => "https://github.com/forestryio/jekyll-menus.git"
gem 'jekyll-titles-from-headings'
Expand Down
10 changes: 10 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ GIT
jekyll-menus (0.6.1)
jekyll (>= 3.6, < 5.0)

GIT
remote: https://github.com/mporcheron/jekyll-last-commit.git
revision: 35b771f9c6aafd87ba92190f843daa16d6b4487f
specs:
jekyll-last-commit (0.0.3)
jekyll (>= 3.7, < 5.0)
rugged (~> 1.1)

GEM
remote: https://rubygems.org/
specs:
Expand Down Expand Up @@ -79,6 +87,7 @@ GEM
rexml (3.3.6)
strscan
rouge (4.3.0)
rugged (1.7.2)
safe_yaml (1.0.5)
sass-embedded (1.77.8-arm64-darwin)
google-protobuf (~> 4.26)
Expand All @@ -100,6 +109,7 @@ DEPENDENCIES
jekyll (~> 4.3.3)
jekyll-datapage-generator (~> 1.4.0)
jekyll-feed
jekyll-last-commit!
jekyll-menus!
jekyll-titles-from-headings
nokogiri
Expand Down
10 changes: 9 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ permalink: /blog/:year/:month/:day/:title/
repository: mixedrealitylab/tas-symposium
produrl: https://symposium.tas.ac.uk/2024

github:
repo: https://github.com/mixedrealitylab/tas-symposium/
link_title: "View edit on GitHub"

# Social settings
social:
browser:
Expand All @@ -67,7 +71,11 @@ plugins:
# - jekyll-datapage-generator
# - jekyll-target-blank

# Liquid config
jekyll-last-commit:
date_format: '%d-%b-%Y %R' # default: `%B %d, %Y`
should_fall_back_to_mtime: false # default: `true`
data_files_key: 'meta' # default: meta

liquid:
error_mode: strict
strict_variables: false
Expand Down
1 change: 1 addition & 0 deletions _includes/footer.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<p class="mb-0 py-3">
&copy; {{ site.time | date: "%Y" }} UKRI Trustworthy Autonomous Systems Hub<br>
{%- include footer_lastmod.html -%}
<!-- Designed by <a href="https://www.porcheron.uk/" title="Martin Porcheron's website">Martin Porcheron</a> and built with <a href="https://jekyllrb.com/" title="Jekyll website generator">Jekyll</a>.<br>-->
</p>
45 changes: 18 additions & 27 deletions _includes/footer_lastmod.html
Original file line number Diff line number Diff line change
@@ -1,30 +1,21 @@
{%- assign last_modified_str = false -%}
{%- assign last_modified_intro = false -%}
{%- assign last_modified = false -%}

{%- if page.lastmod == 'page' -%}

{% capture last_modified_str %}{{ page.last_modified_at | date_to_long_string: "ordinal" }}{% endcapture %}

{%- elsif page.lastmod.type == 'data' -%}

{%- capture timestamp_date -%}{{ page.lastmod.file | data_file_last_mod: "%-d" }}{%- endcapture -%}
{%- capture timestamp_rest -%}{{ page.lastmod.file | data_file_last_mod: "%B %Y" }}{%- endcapture -%}

{%- if timestamp_date == "1" or timestamp_date == "21" or timestamp_date == "31" -%}
{%- assign suffix = "st" -%}
{%- elsif timestamp_date == "2" or timestamp_date == "22" -%}
{%- assign suffix = "nd" -%}
{%- elsif timestamp_date == "3" or date == "23" -%}
{%- assign suffix = "rd" -%}
{%- else -%}
{%- assign suffix = "th" -%}
{%- assign newest_source = page -%}
{%- if page.lastmod.type == "data" and page.lastmod.file -%}
{%- if page.last_commit.time_epoch < site.data.meta[page.lastmod.file].last_commit.time_epoch -%}
{%- assign newest_source = site.data.meta[page.lastmod.file] -%}
{%- endif -%}
{%- elsif page.lastmod.type == "data" and page.lastmod.files -%}
{%- assign newest_data_file = site.data.meta[page.lastmod.files.first] -%}
{%- for file in page.lastmod.files -%}
{%- assign candidate = site.data.meta[file] -%}
{%- if candidate.last_commit.time_epoch > newest.last_commit.time_epoch -%}
{%- assign newest_data_file = candidate -%}
{%- endif -%}

{%- capture last_modified_str -%}{{ timestamp_date }}{{ suffix }} {{ timestamp_rest }}{%- endcapture -%}

{%- endfor -%}
{%- if page.last_commit.time_epoch < newest.last_commit.time_epoch -%}
{%- assign newest_source = newest -%}
{%- endif -%}
{%- endif -%}

{%- if last_modified_str != false -%}
Last modified on {{ last_modified_str }}<br>
{%- endif -%}
Last modified: <a href="{{- site.github.repo -}}commit/{{- newest_source.last_commit.sha -}}" title="{{- site.github.link_title -}}" class="text-muted" target="_blank">
{{- newest_source.last_modified_at_formatted -}}
</a>
6 changes: 6 additions & 0 deletions program/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@

splash_title: TAS '24 program

lastmod:
type: data
files:
- prg_presentations.yml
- prg_sessions.yml

menus:
main:
title: Program
Expand Down
5 changes: 5 additions & 0 deletions program/workshops.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ description: >
splash_title: Workshops at TAS '24

lastmod:
type: data
files:
- workshops.yml

menus:
programme:
title: Workshops
Expand Down

0 comments on commit f86a78b

Please sign in to comment.