www-from-model/layouts/_partials/publication-item.html
Stephan Heunis 066c879dfe
Some checks failed
Deploy on webserver / Build site and deploy on success (push) Failing after 1s
New approach to extracting publication data and filtering/searching it
This commit introduces the process for individual publication term page
generation, which includes a new jinja template and workflow. Since
'publications' is a taxonomy, the workflow renders the term page at
'content/publications/pub-pid/_index.md'. For the same reason, the
(more) correct html template to use would be 'publications/taxonomy.html'
instead of 'publications/list.html' (which is actually the fallback),
hence the replacement.

Since, individual publication metadata are included in each individual
term page front matter, the taxonomy page has been updated to grab that
metadata instead of reading the json object from 'data/publications.json'.
This also allows the associated workflow to be dropped.

A new 'publication-item' partial is introduced to allow better control
over the rendering of individual items in the publication list on the
taxonomy page. This intentionally shifts the rendering that was previously
done in JS code to Hugo templating. Because hugo only runs the rendering
on app build, the searching/filtering approach had to be changed so that
all publications are rendered by default and required items are hidden
depending on the filtering options selected or search terms entered.
This is done in updated JS code, by assigning 'display: none' when
applicable. Other JS additions include:
- adding a count of filtered items
- a new 'Clear all' button for clearing filters
- allowing Topic pills to be clicked in order to add filter options

TODO: customize the publications term page template for improved individual
publication display.
2026-04-13 10:53:44 +02:00

67 lines
No EOL
2.3 KiB
HTML

<article
class="pub mb-6 border border-neutral-200 dark:border-neutral-700"
data-kind="{{ .Params.kind }}"
data-year="{{ if .Params.date }}{{ substr .Params.date 0 4 }}{{ else }}unknown{{ end }}"
data-topics='{{ .Params.topic | jsonify }}'
data-authors='{{ .Params.author | jsonify }}'
data-title="{{ .Title | lower }}"
style="border-radius: 5px; padding: 1em;"
>
<!-- Title, including year and DOI and publication kind -->
<h3 class="text-xl font-semibold text-neutral-900 dark:text-neutral-100" style="margin-top: 0;">
<a href="{{ .RelPermalink }}" style="text-decoration: unset;">
{{ .Title }}
</a>
{{ if .Params.date }}
{{ $year := substr .Params.date 0 4 }}
<span class="text-neutral-500 text-base font-normal">
({{ $year }})
</span>
{{ end }}
{{ with .Params.doi }}
<span class="mt-3 text-sm" style="border-left: 1px solid grey; padding-left: 0.5em;">
<a
href="https://doi.org/{{ . }}"
target="_blank"
class="text-primary-600"
style="text-decoration: unset;"
>
DOI: {{ . }}
</a>
</span>
{{ end }}
{{ with .Params.kind }}
<span class="mt-3 text-xs" style="font-style: italic; border-left: 1px solid grey; padding-left: 0.5em; margin-left: 0.5em;">
{{ . | replaceRE "^.*:" "" }}
</span>
{{ end }}
</h3>
<!-- Authors -->
{{ with .Params.author }}
<div class="mt-2 flex flex-wrap gap-2">
{{ range $i, $a := . }}
<span class="text-sm px-2 py-1 rounded-full border border-neutral-200 dark:border-neutral-700 whitespace-nowrap">
{{ $a.given_name }} {{ $a.family_name }}
</span>
{{ end }}
</div>
{{ end }}
<!-- Topics -->
{{ with .Params.topic }}
<div class="flex flex-wrap gap-2" style="margin-top: 1em;">
{{ range . }}
<span
class="topic-chip text-xs bg-neutral-200 dark:bg-neutral-700 text-neutral-800 dark:text-neutral-200 cursor-pointer transition-colors duration-150 hover:bg-primary-100 dark:hover:bg-primary-900 hover:text-primary-700 dark:hover:text-primary-300"
style="border-radius: 4px; padding: 0.5em"
data-topic="{{ .display_label }}"
>
{{ .display_label }}
</span>&nbsp;
{{ end }}
</div>
{{ end }}
</article>