From 7783171b56ef9660e2ca71067bfaeed380db5cfe Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Thu, 26 May 2022 17:27:09 -0400 Subject: [PATCH] get popularity from article path (#28016) --- script/search/build-records.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/script/search/build-records.js b/script/search/build-records.js index 269318d07a..5b1a033cbe 100644 --- a/script/search/build-records.js +++ b/script/search/build-records.js @@ -62,9 +62,8 @@ export default async function buildRecords( .on('page', (page) => { process.stdout.write(pageMarker) const newRecord = parsePageSectionsIntoRecords(page) - const hrefWithoutLocale = page.href.split('/').slice(2).join('/') - - const popularity = (hasPopularPages && popularPages[hrefWithoutLocale]) || 0.0 + const pathArticle = page.relativePath.replace('/index.md', '').replace('.md', '') + const popularity = (hasPopularPages && popularPages[pathArticle]) || 0.0 newRecord.popularity = popularity process.stdout.write(recordMarker) records.push(newRecord)