Skip to content

Commit e31ce0e

Browse files
committed
Sort people by their start_date of each role, tie-breaker by their name
1 parent 2e0bd69 commit e31ce0e

File tree

2 files changed

+48
-24
lines changed

2 files changed

+48
-24
lines changed

_data/authors.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,11 @@ Reihaneh Rabbany:
388388
current_role:
389389
type: Faculty
390390
title: Assistant Professor
391+
research_directions:
392+
- online-toxicity
393+
- poli-sci
394+
- online-crime
395+
- temporal-graph-learning
391396
social_media_links:
392397
- label: Website
393398
url: http://www.reirab.com/
@@ -499,6 +504,9 @@ Zachary Yang:
499504
title: PhD
500505
advisor: Reihaneh Rabbany
501506
start_date: Winter 2021
507+
research_directions:
508+
- online-toxicity
509+
- poli-sci
502510
social_media_links:
503511
- label: Website
504512
url: https://rstzzz.github.io/
Lines changed: 40 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,74 @@
1-
<!-- Control which set of authors to show for the people page -->
2-
{% for hash in include.authors -%}
3-
{% assign author = hash[1] -%}
4-
1+
<!-- First collect the authors that should be shown -->
2+
{% assign authors_to_show = '' | split: '' %}
3+
{% for hash in include.authors %}
4+
{% assign author = hash[1] %}
55
{% assign show_author = false %}
66

77
{% if include.render_current_role %}
8-
98
{% if author.current_role.type == include.role %}
10-
119
{% if include.title %}
1210
{% if author.current_role.title == include.title %}
1311
{% assign show_author = true %}
1412
{% assign role_to_render = author.current_role %}
1513
{% endif %}
16-
1714
{% else %}
18-
1915
{% assign show_author = true %}
2016
{% assign role_to_render = author.current_role %}
21-
2217
{% endif %}
23-
2418
{% endif %}
25-
2619
{% else %}
27-
2820
{% for past_role in author.past_roles %}
29-
3021
{% if past_role.type == include.role %}
31-
3222
{% if include.title %}
3323
{% if past_role.title == include.title %}
3424
{% assign show_author = true %}
3525
{% assign role_to_render = past_role %}
3626
{% break %}
3727
{% endif %}
38-
39-
4028
{% else %}
41-
4229
{% assign show_author = true %}
4330
{% assign role_to_render = past_role %}
4431
{% break %}
4532
{% endif %}
33+
{% endif %}
34+
{% endfor %}
35+
{% endif %}
4636

37+
{% if show_author %}
38+
{% assign entry = "" | split: "" %}
39+
{% assign start_date = role_to_render.start_date | default: "9999" %}
40+
41+
{% if start_date contains "Fall" or start_date contains "Winter" or start_date contains "Summer" %}
42+
{% assign season_year = start_date | split: " " %}
43+
{% if season_year[0] == "Fall" %}
44+
{% assign month = "09" %}
45+
{% elsif season_year[0] == "Winter" %}
46+
{% assign month = "01" %}
47+
{% elsif season_year[0] == "Summer" %}
48+
{% assign month = "05" %}
49+
{% endif %}
50+
{% assign formatted_date = season_year[1] | append: month %}
51+
{% else %}
52+
{% assign formatted_date = start_date | date: "%Y%m" %}
53+
{% endif %}
4754

48-
55+
{% assign sort_key = formatted_date | append: "|" | append: author.name %}
56+
{% assign entry = entry | push: sort_key %}
57+
{% assign entry = entry | push: author %}
58+
{% assign entry = entry | push: role_to_render %}
59+
{% assign authors_to_show = authors_to_show | push: entry %}
4960
{% endif %}
61+
62+
5063
{% endfor %}
5164

5265

53-
{% endif %}
66+
{% assign sorted_authors = authors_to_show | sort %}
5467

55-
{% if show_author %}
68+
<!-- Then display the filtered authors -->
69+
{% for entry in sorted_authors %}
70+
{% assign author = entry[1] %}
71+
{% assign role_to_render = entry[2] %}
5672

5773
{% assign loading = "lazy" %}
5874
{% if include.render_current_role %}
@@ -61,9 +77,9 @@
6177
{% endunless %}
6278
{% endif %}
6379

64-
{% include display-author.html author=author loading=loading render_current_role=include.render_current_role
80+
{% include display-author.html
81+
author=author
82+
loading=loading
83+
render_current_role=include.render_current_role
6584
role_to_render=role_to_render %}
66-
67-
{% endif %}
68-
6985
{% endfor %}

0 commit comments

Comments
 (0)