Skip to content

Commit 5709e8e

Browse files
author
Andrea Barbasso
committed
[DSC-2862] improve authoritylink behavior, add X to websites
1 parent 8fcc1ba commit 5709e8e

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

src/app/cris-layout/cris-layout-matrix/cris-layout-box-container/boxes/metadata/rendering-types/link-authority/link-authority.component.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,16 @@ export class LinkAuthorityComponent extends RenderingTypeValueModelComponent imp
6969
return iconStyle;
7070
}
7171

72-
if (siteUrl.includes('linkedin')) {
72+
const hostname = new URL(siteUrl)?.hostname?.replace(/^www\./, '') ||
73+
siteUrl.toLowerCase();
74+
75+
if (/^(linkedin\.com|lnkd\.in)$/.test(hostname)) {
7376
iconStyle = 'fab fa-linkedin';
74-
} else if (siteUrl.includes('twitter')) {
77+
} else if (/^(twitter\.com|x\.com|t\.co)$/.test(hostname)) {
7578
iconStyle = 'fa-brands fa-x-twitter';
76-
} else if (siteUrl.includes('instagram')) {
79+
} else if (/^(instagram\.com|instagr\.am)$/.test(hostname)) {
7780
iconStyle = 'fab fa-instagram';
78-
} else if (siteUrl.includes('facebook')) {
81+
} else if (/^(facebook\.com|fb\.com)$/.test(hostname)) {
7982
iconStyle = 'fab fa-facebook';
8083
}
8184
return iconStyle;

0 commit comments

Comments
 (0)