From 0ef2db146bc6c965e15582713e3a16ab4136c04b Mon Sep 17 00:00:00 2001 From: igorbaptist4 Date: Wed, 11 Sep 2024 14:48:59 -0300 Subject: [PATCH] Configuring the URI link target --- .../metadata-values/metadata-values.component.html | 5 ++++- .../metadata-values/metadata-values.component.ts | 12 ++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/app/item-page/field-components/metadata-values/metadata-values.component.html b/src/app/item-page/field-components/metadata-values/metadata-values.component.html index 44a3657fa56..4fc0b41136c 100644 --- a/src/app/item-page/field-components/metadata-values/metadata-values.component.html +++ b/src/app/item-page/field-components/metadata-values/metadata-values.component.html @@ -18,7 +18,10 @@ - diff --git a/src/app/item-page/field-components/metadata-values/metadata-values.component.ts b/src/app/item-page/field-components/metadata-values/metadata-values.component.ts index c6ff4547371..7bc91237d15 100644 --- a/src/app/item-page/field-components/metadata-values/metadata-values.component.ts +++ b/src/app/item-page/field-components/metadata-values/metadata-values.component.ts @@ -134,4 +134,16 @@ export class MetadataValuesComponent implements OnChanges { hasInternalLink(linkValue: string): boolean { return linkValue.startsWith(environment.ui.baseUrl); } + + /** + * This method performs a validation and determines the target of the url. + * @returns - Returns the target url. + */ + getLinkAttributes(urlValue: string): { target: string, rel: string } { + if (this.hasInternalLink(urlValue)) { + return { target: '_self', rel: '' }; + } else { + return { target: '_blank', rel: 'noopener noreferrer' }; + } + } }