From c7b2eee5a6b8f9adc863cccb2b8a999dcc667a26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Sun, 12 Jun 2022 14:05:01 +0200 Subject: [PATCH] i18n: fix search for cyrillic #269 --- layouts/partials/search.html | 8 +++++++- static/js/search.js | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/layouts/partials/search.html b/layouts/partials/search.html index 07cb7b0375..03a147a71e 100644 --- a/layouts/partials/search.html +++ b/layouts/partials/search.html @@ -4,6 +4,12 @@ {{- $assetBusting := not .Site.Params.disableAssetsBusting }} - + {{- $pageBaseLang := replaceRE "([a-z]+).*" "${1}" .Page.Lang }} + + + + \ No newline at end of file diff --git a/static/js/search.js b/static/js/search.js index ed083dbdd7..50767bc706 100644 --- a/static/js/search.js +++ b/static/js/search.js @@ -9,6 +9,10 @@ function initLunr() { // Set up lunrjs by declaring the fields we use // Also provide their boost level for the ranking lunrIndex = lunr(function() { + if(lunr[pageBaseLang]){ + this.use(lunr[pageBaseLang]); + } + this.ref('index'); this.field('title', { boost: 15