Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
kebbie
/
wp-content
/
plugins
/
extendify
/
src
/
Notifications
:
notification-link.js
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
// A partner-authored link can't know the customer's host at authoring time. const withSiteHost = (link, host) => link?.replaceAll('{SITEURL}', host); export const resolveNotificationLink = (notification, host = '') => { const href = withSiteHost(notification?.link, host); if (!href) return {}; try { return { href, external: new URL(href).host !== host }; } catch { // URL() throws on relative paths, which are never external. return { href }; } }; // `rel` travels with `target`, or the new tab keeps a handle back to wp-admin. export const externalLinkProps = (external) => external ? { target: '_blank', rel: 'noreferrer' } : {};