{# Copyright (C) 2026 Front Matter. invenio-pidbox is free software; you can redistribute it and/or modify it under the terms of the MIT License; see LICENSE file for more details. Metrics for a set of records, the same cards invenio-pidbox shows for one person or organization: absolute counts in the first row, shares of all works in the second, and a column beside them that the instance chooses (metrics_column.html): the share with an open license in a ring, or cards of its own, one per row. Each card links to the search it counts. The numbers come from a records API in the browser, so the page renders without waiting for them, and the cards stay hidden while there are no records. Included with four variables: metrics_id the id of the container, unique on the page metrics_api the records API to count with, e.g. /api/records metrics_search the search page the cards link to, e.g. /search metrics_column the first column, as pidbox_metrics_column returns it And, optionally, four more: metrics_query the query of the records the cards count, "" for all metrics_noun what the labels call them: "work", "post" or "award"; by default PIDBOX_METRICS_NOUN. The ORCID and ROR ID cards of the awards count their contributors. metrics_hide the cards left out, of the two rows and the first column, e.g. ["references", "license"]; the first column keeps its place, empty, when it has nothing left metrics_show the cards added to the second row, before the hidden ones are left out: ["ror"], the share with a ROR ID #} {%- set metrics_query = metrics_query if metrics_query is defined else "" %} {%- set metrics_hide = metrics_hide if metrics_hide is defined else [] %} {%- set metrics_show = metrics_show if metrics_show is defined else [] %} {%- set pidbox_labels = pidbox_metrics_labels(metrics_noun if metrics_noun is defined else none) %} {%- set metrics_noun = metrics_noun if metrics_noun is defined else none %} {%- set pidbox_searches = pidbox_metrics_searches(metrics_noun) %} {%- from "invenio_pidbox/metrics_styles.html" import metrics_styles %} {{ metrics_styles("#" ~ metrics_id) }} {%- macro metrics_card(id, label, icon_label) %}
{{ label }}
{%- endmacro %} {#- As on the person and organization pages: the first column four wide, and the cards, two rows of three, in a twelve wide one beside it, in line with the results of a search. #} {%- set column = (metrics_column if metrics_column is defined else pidbox_metrics_column(["license"])) | rejectattr("card", "in", metrics_hide) | list %} {%- set rows = [ [("works", pidbox_labels.works, _("Article")), ("recent", pidbox_labels.recent, _("Date range")), ("citations", pidbox_labels.citations, _("Citations"))], [("ror", pidbox_labels.ror, "ROR"), ("orcid", pidbox_labels.orcid, "ORCID"), ("references", pidbox_labels.references, _("References")), ("funding", pidbox_labels.funding, _("Funding"))], ] %} {#- The ROR ID card only where it is added; the cards hidden left out. #} {%- set metrics_off = metrics_hide + (["ror"] if "ror" not in metrics_show else []) %}