Hugo网站更新Pagefind本地搜索(4)

2026-09-16
#Blog #macOS

1. 前言

Hugo 网站,也就是个人网站,是利用 Pagefind 来实现本地搜索。运行至今,效果满意。

之前的安装和设置,见:Hugo网站设置Pagefind本地搜索(3)

此次,需要更新 Pagefind 到最新版 1.5.2

2. 更新步骤

  1. 命令行切换路径到 blog/ 下:
cd blog/
  1. 输入更新命令:
npx pagefind@latest --site public

更新信息如下:

blog git:(master) ✗ npx pagefind@latest --site public
Need to install the following packages:
pagefind@1.5.2
Ok to proceed? (y) y


Running Pagefind v1.5.2 (Extended)
Running from: "/Users/deng/blog"
Source:       "public"
Output:       "public/pagefind"

[Walking source directory]
Found 2560 files matching **/*.{html}

[Parsing files]
Found a data-pagefind-body element on the site.
↳ Ignoring pages without this tag.

[Reading languages]
Discovered 1 language: zh

[Building search indexes]
Total: 
  Indexed 1 language
  Indexed 2381 pages
  Indexed 71697 words
  Indexed 0 filters
  Indexed 0 sorts
Note: Pagefind doesn't support stemming for the language zh. 
Search will still work, but will not match across root words.
Note: Pagefind doesn't support stemming for the language zh. 
Search will still work, but will not match across root words.

┌─────────────────────────────────────────────────────────────────────────┐
│  Pagefind found references to the Default UI (pagefind-ui.js)           │
│  on your site. The Default UI is supported and will continue            │
│  to work.                                                               │
│                                                                         │
│  As of 1.5.0, if you are setting up a new integration, use the          │
│  Component UI instead. It includes a search modal, better               │
│  accessibility and customization: https://pagefind.app/docs/search-ui/  │
└─────────────────────────────────────────────────────────────────────────┘

Finished in 2.484 seconds