From 7f505babbee72c8f220113c81f99b0c0180936ad Mon Sep 17 00:00:00 2001 From: Kevin Payravi Date: Wed, 30 Aug 2023 23:12:59 -0600 Subject: [PATCH] For search engine filtering, attempt to match content path --- content-search-filtering.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/content-search-filtering.js b/content-search-filtering.js index dbadbd9..fb1f6c2 100644 --- a/content-search-filtering.js +++ b/content-search-filtering.js @@ -139,9 +139,14 @@ function filterSearchResults(searchResults, searchEngine, storage) { console.log('Indie Wiki Buddy failed to properly parse search results with error: ' + e); } // Check if site is in our list of wikis: - let matchingSites = sites.filter(el => - String(decodeURIComponent(searchResultLink)).includes('https://' + el.origin_base_url) - ); + let matchingSites = sites.filter(el => { + let link = String(decodeURIComponent(searchResultLink)); + if (link.substring(8).includes('/')) { + return link.includes('https://' + el.origin_base_url + el.origin_content_path); + } else { + return link.includes('https://' + el.origin_base_url); + } + }); if (matchingSites.length > 0) { // Select match with longest base URL let closestMatch = "";