uPagge / uBlogger

A template designed with your readers in mind :heart:
https://ublogger.netlify.app
MIT License
250 stars 101 forks source link

[FEATURE] Multi-language content search by lunr.js #137

Open chinkung opened 3 years ago

chinkung commented 3 years ago

Describe the feature you want

Currently uBlogger only able to search in single language only. e.g. if you have more then 1 language (e.g. Thai and English), it would not able to search.

Useful reference

Please take a look at MULTI-LANGUAGE CONTENT in https://lunrjs.com/guides/language_support.html

You need to load additional lunr.multi.js and allow to add additional support lunr-languages in config.toml

var lunr = require("lunr")
require("lunr-languages/lunr.stemmer.support")(lunr)
require('lunr-languages/lunr.multi')(lunr)
require("lunr-languages/lunr.de")(lunr)

var idx = lunr(function () {
  this.use(lunr.multiLanguage('en', 'de'))
})