Skip to content

Commit

Permalink
improve builtin timeline custom field option
Browse files Browse the repository at this point in the history
  • Loading branch information
evanwill committed Apr 5, 2024
1 parent 26c307c commit f1b6569
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions _layouts/timeline.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
layout: page
custom-foot: js/timeline-js.html
---
{%- assign field = site.data.theme.timeline-field | default: "date" -%}
{%- assign field = site.data.theme.timeline-field | default: page.timeline-field | default: "date" -%}
{% if site.data.theme.timeline-child-objects == true %}
{%- assign items = site.data[site.metadata] | where_exp: 'item','item.objectid' -%}
{% else %}
Expand All @@ -12,7 +12,7 @@
{%- assign items = items | where_exp: 'item','item[field]' -%}
{%- assign raw-dates = items | map: field | compact | uniq -%}
{%- capture clean-years -%}{% for date in raw-dates %}{% if date contains "-" %}{{ date | strip | split: "-" | first }}{% elsif date contains "/" %}{{ date | strip | split: "/" | last }}{% else %}{{ date | strip }}{% endif %}{% unless forloop.last %};{% endunless %}{%- endfor -%}{%- endcapture -%}
{%- assign uniqueYears = clean-years | remove: " " | replace: ";;",";" | split: ";" | uniq | sort -%}
{%- assign uniqueYears = clean-years | replace: ";;",";" | split: ";" | compact | uniq | sort -%}
{%- if site.data.theme.year-navigation -%}
{%- assign navYears = site.data.theme.year-navigation | split: ";" -%}
{%- elsif site.data.theme.year-nav-increment -%}
Expand Down

0 comments on commit f1b6569

Please sign in to comment.