Closed Yuuzi261 closed 1 month ago
Will look into it
Pagefind needs to know the webpage's language to index the content correctly. By default, it is the site language in the config.ts
. That is why posts in Chinese cannot be indexed when the site's language is set to en
.
To fix it, you can specify the lang
attribute in the front-matter of the post, which overrides the site language setting.
lang: zh_TW
Description
When I was searching, I found that I could not find the posts I had written, so I did some tests. Is this a bug?
SiteConfig.lang = 'en' & language of posts = 'zh_TW'
I can only search About in English, and cannot search in Chinese.
SiteConfig.lang = 'zh_TW' & language of posts = 'zh_TW'
Everything works fine.
SiteConfig.lang = 'en' & language of posts = 'en'
After knowing that the problem was caused by language, I also set the language of the Chinese posts to English. I can search in English, but the preview of Chinese posts becomes strange, and I can't search in Chinese either.
Conclusion
Because the
SiteConfig.lang
will affect the language of the UI setting, if I want the UI to be in English, but it will result in Chinese posts not being searched, it is not very convenient.