{# Copyright (C) 2026 Front Matter. Invenio App RDM is free software; you can redistribute it and/or modify it under the terms of the MIT License; see LICENSE file for more details. #} {% if community %} {% if collection %} {% set root_collection=collection[collection.root] %} {% set options = [ { "key": "collections", "text": _("In this collection"), "value": url_for("invenio_app_rdm_communities.community_collection", pid_value=community.slug, collection_slug=root_collection.slug, tree_slug=tree.slug) }, { "key": "communities", "text": _("In this community"), "value": url_for("invenio_app_rdm_communities.communities_detail", pid_value=community.slug), }, { "key": "records", "text": _("All") + " " + config.THEME_SITENAME, "value": url_for("invenio_search_ui.search"), }] %} {% else %} {% set options = [ { "key": "communities", "text": _("In this community"), "value": url_for("invenio_app_rdm_communities.communities_detail", pid_value=community.slug), }, { "key": "records", "text": _("All Works"), "value": url_for("invenio_search_ui.search"), }] %} {% endif %} {% else %} {# Each kind is offered only when its profiles are switched on, because that switch is what registers the route. Building the URL unconditionally raises BuildError when the kind is off — on every page that renders the search bar, which is every page — and both switches default to off. `config.X` on a missing key yields Undefined, which is falsy, so this is also correct for an app that never loaded the extension. #} {% set options = [ { "key": "records", "text": _("All Works"), "value": url_for("invenio_search_ui.search"), }] %} {% if config.PIDBOX_PERSON_PROFILES %} {% set options = options + [ { "key": "people", "text": _("People"), "value": url_for("invenio_pidbox.people_search"), }] %} {% endif %} {% if config.PIDBOX_ORGANIZATION_PROFILES %} {% set options = options + [ { "key": "organizations", "text": _("Organizations"), "value": url_for("invenio_pidbox.organizations_search"), }] %} {% endif %} {% endif %}