Pagefind issue with Chinese character
/ 1 min read
Table of Contents
Overview
Text search currently uses Pagefind with the default postbuild command:
pagefind --site distBecause the site declares lang="en-US", Pagefind builds an English-language index. This works for ordinary English searches, but it can behave unexpectedly with Chinese text embedded in English posts.
What Happens
In an English index, Pagefind may treat these as joined tokens after punctuation is removed. A query such as 底牌 may not match, while a joined form such as cards底牌 can match.
Chinese terms that appear with clearer spacing or as standalone text are more likely to work as expected.
Possible Fix
For better Chinese search behavior, rebuild Pagefind with a Chinese language override:
pagefind --site dist --force-language zhThat makes Pagefind use Chinese word segmentation, which improves searches for Chinese terms.
For now, the site keeps the existing English index. If Chinese search becomes more important, the postbuild script can be changed later.