File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
src/app/item-page/field-components/metadata-values Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 1818
1919<!-- Render value as a link (href and label) -->
2020< ng-template #link let-value ="value ">
21- < a class ="dont-break-out ds-simple-metadata-link " target ="_blank " [href] ="value ">
21+ < a class ="dont-break-out ds-simple-metadata-link "
22+ [href] ="value "
23+ [attr.target] ="getLinkAttributes(value).target "
24+ [attr.rel] ="getLinkAttributes(value).rel ">
2225 {{value}}
2326 </ a >
2427</ ng-template >
Original file line number Diff line number Diff line change @@ -134,4 +134,16 @@ export class MetadataValuesComponent implements OnChanges {
134134 hasInternalLink ( linkValue : string ) : boolean {
135135 return linkValue . startsWith ( environment . ui . baseUrl ) ;
136136 }
137+
138+ /**
139+ * This method performs a validation and determines the target of the url.
140+ * @returns - Returns the target url.
141+ */
142+ getLinkAttributes ( urlValue : string ) : { target : string , rel : string } {
143+ if ( this . hasInternalLink ( urlValue ) ) {
144+ return { target : '_self' , rel : '' } ;
145+ } else {
146+ return { target : '_blank' , rel : 'noopener noreferrer' } ;
147+ }
148+ }
137149}
You can’t perform that action at this time.
0 commit comments