For search engine filtering, attempt to match content path

pull/227/head
Kevin Payravi 2023-08-30 23:12:59 -06:00
parent d69af4106b
commit 7f505babbe
1 changed files with 8 additions and 3 deletions

View File

@ -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 = "";