From e35e68d76403a3fa1971aeb04e9065940055ee62 Mon Sep 17 00:00:00 2001 From: NGPixel Date: Sat, 23 Nov 2019 16:13:41 -0500 Subject: [PATCH] fix: exclude assets from internal link detection (#1189) --- server/modules/rendering/html-core/renderer.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/server/modules/rendering/html-core/renderer.js b/server/modules/rendering/html-core/renderer.js index 400a9a74..8fc079eb 100644 --- a/server/modules/rendering/html-core/renderer.js +++ b/server/modules/rendering/html-core/renderer.js @@ -53,7 +53,11 @@ module.exports = { } // -> Check for system prefix - if (!reservedPrefixes.test(href) && !exactReservedPaths.test(href)) { + if (reservedPrefixes.test(href) || exactReservedPaths.test(href)) { + $(elm).addClass(`is-system-link`) + } else if (href.indexOf('.') >= 0) { + $(elm).addClass(`is-asset-link`) + } else { let pagePath = null // -> Add locale prefix if using namespacing @@ -91,8 +95,6 @@ module.exports = { }) $(elm).addClass(`is-internal-link`) - } else { - $(elm).addClass(`is-system-link`) } } else { $(elm).addClass(`is-external-link`)