跳过正文

Search

首次發表:

Yore built-in search utilizes Fuse.js to provide client-side indexing and real-time search results.

Configuration

To enable search functionality, you must configure both the global parameters and the Hugo output formats. Ensure the search feature is toggled on:

hugo.yaml
params:
  searchEnabled: true

Search requires a JSON index to function. Update your hugo.yaml to generate the fuse-search output for the home page:

hugo.yaml
outputs:
  home:
    - HTML
    - RSS
    - fuse-search

outputFormats:
  fuse-search:
    mediaType: application/json
    baseName: fuse-search
    isPlainText: true
    notAlternative: true
    weight: 10
信息

To exclude specific pages from the search index, use the pageNoList parameter in that page's front matter.

Keyboard Shortcuts

  • /, Ctrl + K or Cmd + K to open the search modal.
  • Esc to close.
  • ArrowUp and ArrowDown to navigate

Search Scope & Weighting

The search module indexes all the regular pages, following fields with decreasing priority:

  1. Title (Highest weight)
  2. Summary & Headings
  3. Content (Lowest weight)