Skip to content

Integrate Pagefind options into existing pages configuration #2874

Description

@MoshiMoshiMochi

Please confirm that you have searched existing issues in the repo

Yes, I have searched the existing issues

Any related issues?

#205

What is the area that this feature belongs to?

No response

Is your feature request related to a problem? Please describe.

Pagefind configuration in MarkBind currently exists as a separate pagefind object in site.json, disconnected from the pages array where content scoping is already defined:

{
  "pagefind": {
    "exclude_selectors": [".algolia-no-index"],
    "glob": ["**/api/**"]
  }
  "pages": [...],
}

The searchable option on pages already determines which pages should be indexed by the built-in search. However, pagefind.glob requires separately declaring which globs to include.

As the goal is to integrate pagefind as the default search within Markbind (eventually replacing the built-in search), the current implementation results in redundancy as users will have to declare the seperate

Hence, we should take advantage of the current searchable option to

  1. Remove the redundancy incurred from above
  2. Support a more seamless onboarding/switching process from the current built-in search to pagefind search.

Describe the solution you'd like

Align pagefind's glob-based exclusion with existing src/glob patterns used within pages.

{
  "pages": [
    {
      "glob": "**/guide_1/**",
      "searchable": false
    }
  ]
}

From the above example, pagefind should be able NOT be indexing any pages with the pattern **/guide_1/** while all other pages should be indexed.

Potential implementation steps:

  1. Modify SitePagesManager & SiteConfig.ts to derive Pagefind glob patterns from pages where searchable !== false
  2. Update SiteGenerationManager.ts to use derived globs in indexSiteWithPagefind()
  3. Remove current pagefind's glob options from SiteConfig.ts

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions