Jieiku / abridge

Fast & Lightweight Zola Theme
https://abridge.pages.dev/
MIT License
168 stars 45 forks source link

Multilingual search #95

Closed ghost closed 1 year ago

ghost commented 1 year ago

Hello,

the documentation does not mention how to customize the search. By default search points to https://abridge.netlify.app/. It seems to me that the search_bundle.min.js needs to be adjusted. But how it this done properly?

Jieiku commented 1 year ago

You have to configure the site in the config.toml file

base_url = "https://abridge.netlify.app"

You will find there are many things in this file that have to be adjusted.

https://www.getzola.org/documentation/getting-started/configuration/

If you did not yet read over the Abridge readme, pay particular attention to this section:

https://github.com/Jieiku/abridge#step-6-add-provisions-for-search_facadejs-dynamic-ondemand-loading-of-search-related-js-or-disable-the-facade

I use npm as outlined to generate a new bundle, but if you would rather not have to do this, then you can set js_search_facade = false

ghost commented 1 year ago

I have already configured my (multilingual) website with your nice theme. Everything is ready except the search…

In order to run npm run abridge there needs to be installed the package abridge — is it this abridge package? This confuses me a bit as this package is 10 years old…

Please bear with me as I am not a programmer and thank you for your help.

Edit: Setting js_search_facade to false in the config.toml made the search work — however only for the default language. How do I enable it for the other languages?

Jieiku commented 1 year ago

npm run abridge should be ran from the abridge zola theme directory, the reason for this is because that is where the package.json file is which defines the abridge script:

If you inspect the package.json file you will see under "scripts": { all of the defined npm scripts, including the abridge script:

https://github.com/Jieiku/abridge/blob/master/package.json

so for example:

git clone https://github.com/Jieiku/abridge
cd abridge
zola build
npm run abridge
zola build
Jieiku commented 1 year ago

I am uncertain as to why it would not work with multilingual, I can try to reproduce the issue locally and help resolve it, but it may take me a few days, I am currently fighting a cold.

I do know that elasticlunr does support multilingual, but there may be something you need to do to enable this support. You may try searching some of the zola documentation for search multilingual support.

report back if you are able to figure it out, and if I get feeling well enough to help investigate I will let you know.

ghost commented 1 year ago

Alright, I successfully ran npm run abridge and search_facade.js was generated. The search works fine now but as mentioned only for the default language.

I will try to find out how to configure a multilingual search. If find anything I will let you know. Get well soon!

Jieiku commented 1 year ago

Closing for now because I don't have time to try and figure it out, but if you do make changes that better support multilingual search then please send a pull request :)

My understanding was that the default zola search library elasticsearch should already support multiple languages.

Jieiku commented 1 year ago

I added this to my todo list for the Refactor.

Jieiku commented 1 year ago

Also it appears if your other language is Chinese or Japanese that you have to build Zola to support indexing those: https://www.getzola.org/documentation/content/multilingual/