Skip to content

Commit c13ccee

Browse files
committed
Auto-sync: 2026-02-08T14:40:25.286Z
1 parent 9cfd33a commit c13ccee

5 files changed

Lines changed: 294 additions & 0 deletions

File tree

layouts/_partials/hooks/head-end/custom-css.html

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,4 +156,29 @@
156156
.dark .blox-team-showcase .group.relative>div.relative {
157157
background: transparent !important;
158158
}
159+
160+
/* ========================================
161+
Publication Filters - Dark Mode Support
162+
======================================== */
163+
.dark #pub-filters {
164+
background: #1a202c !important;
165+
border-color: #4a5568 !important;
166+
}
167+
.dark #pub-filters label {
168+
color: #e2e8f0 !important;
169+
}
170+
.dark #pub-filters input,
171+
.dark #pub-filters select {
172+
background: #2d3748 !important;
173+
border-color: #4a5568 !important;
174+
color: #e2e8f0 !important;
175+
}
176+
.dark #pub-filters button {
177+
background: #2d3748 !important;
178+
border-color: #4a5568 !important;
179+
color: #e2e8f0 !important;
180+
}
181+
.dark #pub-filter-count {
182+
color: #a0aec0 !important;
183+
}
159184
</style>
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
{{/* Display author list with truncation: show first 5 + owner (Aneesh C Subramanian). */}}
2+
3+
{{- $authors := .Params.authors -}}
4+
5+
{{ if $authors }}
6+
{{- if not (reflect.IsSlice $authors) -}}
7+
{{- $authors = slice $authors -}}
8+
{{- end -}}
9+
10+
{{- $maxShow := 5 -}}
11+
{{- $totalAuthors := len $authors -}}
12+
13+
{{/* Build list of authors to display */}}
14+
{{- $displayAuthors := slice -}}
15+
{{- $ownerIndex := -1 -}}
16+
{{- $ownerName := "" -}}
17+
18+
{{/* Find the owner (Aneesh) in the author list */}}
19+
{{- range $index, $raw := $authors -}}
20+
{{- $lower := $raw | lower -}}
21+
{{- if or (in $lower "aneesh") (in $lower "subramanian") -}}
22+
{{- $ownerIndex = $index -}}
23+
{{- $ownerName = $raw -}}
24+
{{- end -}}
25+
{{- end -}}
26+
27+
{{- if le $totalAuthors $maxShow -}}
28+
{{/* Show all authors if 5 or fewer */}}
29+
{{- $displayAuthors = $authors -}}
30+
{{- else -}}
31+
{{/* Take first 5 authors */}}
32+
{{- $first5 := first $maxShow $authors -}}
33+
{{- $ownerInFirst5 := false -}}
34+
{{- range $index, $raw := $first5 -}}
35+
{{- $lower := $raw | lower -}}
36+
{{- if or (in $lower "aneesh") (in $lower "subramanian") -}}
37+
{{- $ownerInFirst5 = true -}}
38+
{{- end -}}
39+
{{- end -}}
40+
41+
{{- if $ownerInFirst5 -}}
42+
{{/* Owner is already in first 5, just use first 5 */}}
43+
{{- $displayAuthors = $first5 -}}
44+
{{- else if ne $ownerIndex -1 -}}
45+
{{/* Owner exists but not in first 5 — show first 5 + owner */}}
46+
{{- $displayAuthors = $first5 | append $ownerName -}}
47+
{{- else -}}
48+
{{/* Owner not found at all — just show first 5 */}}
49+
{{- $displayAuthors = $first5 -}}
50+
{{- end -}}
51+
{{- end -}}
52+
53+
{{- $truncated := gt $totalAuthors $maxShow -}}
54+
{{- $displayCount := len $displayAuthors -}}
55+
56+
{{ range $index, $raw := $displayAuthors }}
57+
{{- $slug := $raw | urlize -}}
58+
{{- $profile := partial "functions/get_author_profile" (dict "slug" $slug "title" $raw) -}}
59+
{{- $termPage := site.GetPage (printf "/authors/%s" $slug) -}}
60+
{{- $display := $profile.title | default $raw -}}
61+
{{- $highlight_name := false -}}
62+
63+
{{- if gt $index 0 }}, {{ end -}}
64+
65+
{{/* If truncated and this is the last display author and owner was appended, insert "..." before */}}
66+
{{- if and $truncated (eq $index (sub $displayCount 1)) (gt $index (sub $maxShow 1)) -}}
67+
...,&nbsp;
68+
{{- end -}}
69+
70+
<span {{ if $highlight_name }}class="font-bold"{{end}}>
71+
{{- if $termPage -}}
72+
<a href="{{ $termPage.RelPermalink }}">{{ $display }}</a>
73+
{{- else -}}
74+
{{ $display }}
75+
{{- end -}}
76+
</span>
77+
{{- if isset $.Params "author_notes" -}}
78+
{{- $origIndex := $index -}}
79+
{{/* Map display index back to original index for author_notes */}}
80+
{{- if and $truncated (gt $index (sub $maxShow 1)) (ne $ownerIndex -1) -}}
81+
{{- $origIndex = $ownerIndex -}}
82+
{{- end -}}
83+
{{- with (index $.Params.author_notes $origIndex) -}}
84+
<span class="relative inline-block ml-1" x-data="{ tooltip: false }">
85+
<button
86+
@mouseenter="tooltip = true"
87+
@mouseleave="tooltip = false"
88+
@click="tooltip = !tooltip"
89+
class="author-notes text-primary-600 dark:text-primary-400 hover:text-primary-800 dark:hover:text-primary-200 transition-colors cursor-help"
90+
data-tooltip="{{.}}"
91+
aria-label="{{.}}"
92+
type="button"
93+
>
94+
<svg class="inline-block w-4 h-4" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
95+
<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd"></path>
96+
</svg>
97+
</button>
98+
<div
99+
x-show="tooltip"
100+
x-transition:enter="transition ease-out duration-200"
101+
x-transition:enter-start="opacity-0 transform scale-95"
102+
x-transition:enter-end="opacity-100 transform scale-100"
103+
x-transition:leave="transition ease-in duration-150"
104+
x-transition:leave-start="opacity-100 transform scale-100"
105+
x-transition:leave-end="opacity-0 transform scale-95"
106+
@click.away="tooltip = false"
107+
class="absolute z-50 bottom-full left-1/2 transform -translate-x-1/2 mb-2 px-3 py-2 text-sm text-white bg-gray-900 dark:bg-gray-700 rounded-lg shadow-lg whitespace-nowrap"
108+
x-cloak
109+
>
110+
{{.}}
111+
<div class="absolute top-full left-1/2 transform -translate-x-1/2 -mt-1 w-0 h-0 border-l-4 border-r-4 border-t-4 border-transparent border-t-gray-900 dark:border-t-gray-700"></div>
112+
</div>
113+
</span>
114+
{{- end -}}
115+
{{- end -}}
116+
{{- end -}}
117+
118+
{{/* Add "et al." if truncated and owner was in first 5 (no appended owner) */}}
119+
{{- if and $truncated (le $displayCount $maxShow) -}}
120+
, et al.
121+
{{- end -}}
122+
{{/* Add "et al." if truncated and owner was appended (already has "...") */}}
123+
{{- if and $truncated (gt $displayCount $maxShow) -}}
124+
, et al.
125+
{{- end -}}
126+
{{- end -}}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
</div>
2+
</div>
3+
4+
<script>
5+
(function() {
6+
const yearSelect = document.getElementById('pub-year-filter');
7+
const authorInput = document.getElementById('pub-author-search');
8+
const clearBtn = document.getElementById('pub-clear-filters');
9+
const countDiv = document.getElementById('pub-filter-count');
10+
if (!yearSelect || !authorInput) return;
11+
12+
const items = document.querySelectorAll('.pub-list-item.view-citation');
13+
14+
// Populate year dropdown from data attributes
15+
const years = new Set();
16+
items.forEach(function(item) {
17+
const y = item.getAttribute('data-year');
18+
if (y) years.add(y);
19+
});
20+
Array.from(years).sort().reverse().forEach(function(y) {
21+
const opt = document.createElement('option');
22+
opt.value = y;
23+
opt.textContent = y;
24+
yearSelect.appendChild(opt);
25+
});
26+
27+
function filterPubs() {
28+
const selectedYear = yearSelect.value;
29+
const authorQuery = authorInput.value.trim().toLowerCase();
30+
let shown = 0;
31+
let total = items.length;
32+
33+
items.forEach(function(item) {
34+
const itemYear = item.getAttribute('data-year') || '';
35+
const itemAuthors = (item.getAttribute('data-authors') || '').toLowerCase();
36+
37+
const matchYear = !selectedYear || itemYear === selectedYear;
38+
const matchAuthor = !authorQuery || itemAuthors.indexOf(authorQuery) !== -1;
39+
40+
if (matchYear && matchAuthor) {
41+
item.style.display = '';
42+
shown++;
43+
} else {
44+
item.style.display = 'none';
45+
}
46+
});
47+
48+
if (selectedYear || authorQuery) {
49+
countDiv.textContent = 'Showing ' + shown + ' of ' + total + ' publications';
50+
} else {
51+
countDiv.textContent = '';
52+
}
53+
}
54+
55+
yearSelect.addEventListener('change', filterPubs);
56+
authorInput.addEventListener('input', filterPubs);
57+
clearBtn.addEventListener('click', function() {
58+
yearSelect.value = '';
59+
authorInput.value = '';
60+
filterPubs();
61+
});
62+
})();
63+
</script>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{{/* Left alignment / width is set so that multiple blocks with this view & variable length content all left align. */}}
2+
<div class="mt-16 sm:mt-20 container max-w-3xl w-full">
3+
4+
{{/* Publication search/filter UI */}}
5+
<div id="pub-filters" style="margin-bottom: 2rem; padding: 1rem; border: 1px solid #e2e8f0; border-radius: 0.5rem; background: #f7fafc;">
6+
<div style="display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end;">
7+
<div style="flex: 1; min-width: 200px;">
8+
<label for="pub-author-search" style="display: block; font-size: 0.875rem; font-weight: 600; margin-bottom: 0.25rem; color: #4a5568;">Search by Author</label>
9+
<input type="text" id="pub-author-search" placeholder="e.g. Subramanian" style="width: 100%; padding: 0.5rem 0.75rem; border: 1px solid #cbd5e0; border-radius: 0.375rem; font-size: 0.875rem;">
10+
</div>
11+
<div style="min-width: 140px;">
12+
<label for="pub-year-filter" style="display: block; font-size: 0.875rem; font-weight: 600; margin-bottom: 0.25rem; color: #4a5568;">Filter by Year</label>
13+
<select id="pub-year-filter" style="width: 100%; padding: 0.5rem 0.75rem; border: 1px solid #cbd5e0; border-radius: 0.375rem; font-size: 0.875rem; background: white;">
14+
<option value="">All Years</option>
15+
</select>
16+
</div>
17+
<div>
18+
<button id="pub-clear-filters" type="button" style="padding: 0.5rem 1rem; border: 1px solid #cbd5e0; border-radius: 0.375rem; font-size: 0.875rem; background: white; cursor: pointer; color: #4a5568;">Clear</button>
19+
</div>
20+
</div>
21+
<div id="pub-filter-count" style="margin-top: 0.5rem; font-size: 0.8rem; color: #718096;"></div>
22+
</div>
23+
24+
<div class="flex flex-col space-y-3">
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{{ $item := .item }}
2+
{{ $year_value := $item.Params.event_start | default $item.Date }}
3+
{{ $year := (time $year_value).Format "2006" }}
4+
{{ $has_attachments := partial "functions/has_attachments" $item }}
5+
6+
{{/* Build author string for data attribute */}}
7+
{{- $authorStr := "" -}}
8+
{{- if $item.Params.authors -}}
9+
{{- $authorStr = delimit $item.Params.authors ", " -}}
10+
{{- end -}}
11+
12+
<div class="pub-list-item view-citation" style="margin-bottom: 1rem" data-year="{{ $year }}" data-authors="{{ $authorStr | htmlEscape }}">
13+
<i class="far fa-file-alt pub-icon" aria-hidden="true"></i>
14+
15+
{{/* APA Style */}}
16+
{{ if eq (site.Params.hugoblox.content.citations.style | default "apa") "apa" }}
17+
18+
<span class="article-metadata li-cite-author">
19+
{{ partial "page_metadata_authors" $item }}
20+
</span>
21+
({{- $year -}}).
22+
<a href="{{ $item.RelPermalink }}" class="underline">{{ $item.Title }}</a>.
23+
{{ if $item.Params.publication_short }}
24+
{{- $item.Params.publication_short | markdownify -}}.
25+
{{ else if $item.Params.publication }}
26+
{{- $item.Params.publication | markdownify -}}.
27+
{{ end }}
28+
29+
{{ if $has_attachments }}
30+
<div class="flex flex-wrap space-x-3">
31+
{{ partial "page_links" (dict "page" $item "is_list" 1) }}
32+
</div>
33+
{{ end }}
34+
35+
{{/* MLA Style */}}
36+
{{ else }}
37+
38+
<span class="article-metadata li-cite-author">
39+
{{ partial "page_metadata_authors" $item }}.
40+
</span>
41+
<a href="{{ $item.RelPermalink }}">{{ $item.Title }}</a>.
42+
{{ if $item.Params.publication_short }}
43+
{{- $item.Params.publication_short | markdownify -}},
44+
{{ else if $item.Params.publication }}
45+
{{- $item.Params.publication | markdownify -}},
46+
{{ end }}
47+
{{- $year -}}.
48+
49+
{{ if $has_attachments }}
50+
<div class="flex flex-wrap space-x-3">
51+
{{ partial "page_links" (dict "page" $item "is_list" 1) }}
52+
</div>
53+
{{ end }}
54+
55+
{{ end }}
56+
</div>

0 commit comments

Comments
 (0)