# extendify/3.2.1/src/Notifications/notification-link.js

Extendify, version 3.2.1. 26 lines.

- Page: https://pluginprobe.com/plugins/extendify/3.2.1/code/src/Notifications/notification-link.js
- Raw: https://pluginprobe.com/plugins/extendify/3.2.1/raw/src/Notifications/notification-link.js
- Modified: 2026-08-20T19:51:40+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/extendify/3.2.1/code/src/Notifications/notification-link.js#L10-L20`.

```javascript
// A partner-authored link can't know the customer's host at authoring time.
const withSiteHost = (link, host) => link?.replaceAll('{SITEURL}', host);

export const siteHost = () => {
	try {
		return new URL(window.extSharedData?.homeUrl ?? '').host;
	} catch {
		return '';
	}
};

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' } : {};

```
