diff --git a/sonar/config_sonar.py b/sonar/config_sonar.py index c0a0013ec..f4c72b66c 100644 --- a/sonar/config_sonar.py +++ b/sonar/config_sonar.py @@ -574,3 +574,13 @@ SONAR_APP_SWISSCOVERY_SEARCH_URL = 'https://swisscovery.slsp.ch/view/sru/41SLSP_NETWORK' SONAR_APP_SWISSCOVERY_SEARCH_VERSION = '1.1' + +# Link on document identifier +SONAR_APP_DOCUMENT_IDENTIFIER_LINK = { + 'bf:Doi': { + 'default': 'https://doi.org/_identifier_' + }, + 'bf:Local': { + 'swisscovery': 'https://swisscovery.slsp.ch/permalink/41SLSP_NETWORK/1ufb5t2/alma_identifier_' + } +} diff --git a/sonar/modules/documents/templates/documents/record.html b/sonar/modules/documents/templates/documents/record.html index 2de5483db..6664525e4 100644 --- a/sonar/modules/documents/templates/documents/record.html +++ b/sonar/modules/documents/templates/documents/record.html @@ -18,7 +18,7 @@ {%- extends config.RECORDS_UI_BASE_TEMPLATE %} -{% from 'sonar/macros/macro.html' import thumbnail %} +{% from 'sonar/macros/macro.html' import thumbnail, identifier_link %} {% set title = record.title[0] | title_format(current_i18n.language) %} {% set description = record.abstracts[0].value if record.abstracts else None %} @@ -253,15 +253,7 @@
diff --git a/sonar/theme/templates/sonar/macros/macro.html b/sonar/theme/templates/sonar/macros/macro.html index 4df61f850..1b9b9b9ef 100644 --- a/sonar/theme/templates/sonar/macros/macro.html +++ b/sonar/theme/templates/sonar/macros/macro.html @@ -63,3 +63,21 @@ {{ label }} {% endif%} {% endmacro %} + +{% macro identifier_link(identifier) %} +{{ _(identifier.type) }} +{% if identifier.type in config.SONAR_APP_DOCUMENT_IDENTIFIER_LINK %} + {% set source = 'default' if not identifier.source else identifier.source %} + {% if source in config.SONAR_APP_DOCUMENT_IDENTIFIER_LINK[identifier.type] %} + {% set link = config.SONAR_APP_DOCUMENT_IDENTIFIER_LINK[identifier.type][source] %} + {{ identifier.value }} + {% else %} + {{ identifier.value }} + {% endif %} +{% else %} + {{ identifier.value }} +{% endif %} +{% if identifier.source %} + {{ identifier.source }} +{% endif %} +{% endmacro %}