Repository navigation
3di | Implement Pagefind for enhanced search capability (backport #7318) - #7475
Merged
Merged
Conversation
Signed-off-by: Alejandro Hernandez Cordero <ahcorde@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Alejandro Hernandez Cordero <ahcorde@gmail.com> (cherry picked from commit cca51e0)
|
HTML artifacts: https://github.com/ros2/ros2_documentation/actions/runs/43138364993/artifacts/13907989768. To view the resulting site:
|
ahcorde
approved these changes
Nov 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR replaces Sphinx's built-in search with Pagefind, a static, client-side search index, using the Pagefind Component UI (pinned to 1.5.2). Search results can be filtered by the
.. meta::fields added in the Enhance metadata work (#6981).Search UI
⌘K/Ctrl+K). Results appear as you type. Pressing Enter openssearch.htmlwith the term and the selected filters, including fromsearch.htmlitself.search.htmlis a full-page search with a filter sidebar.?q=and filter parameters in the URL are applied on load. Clear resets the term, the filters and the URL.In: Framework › Nodes › …). Optionally they can also show its metadata values.Filters
.. meta::fields listed undersearch_result_metainpagefind.yml, in that order and with those labels. Only those fields become filters; other meta fields stay plain SEO<meta>tags.always_show_filterskeeps chosen filter groups visible, with an empty placeholder when no indexed page has that field.Indexing
data-pagefind-bodyinsource/_templates/layout.html). Redirect stubs from.. redirect-from::are excluded... showmeta::summaries are left out of the index.make multiversionproduces one index at the site root covering every distro. The Distribution filter separates them.Build
make htmlandmake multiversionbuild as before, then runmake pagefind(npx pagefind@1.5.2 --site build/html). This needs Node.js 18+.make serve(sphinx-autobuild) keeps Sphinx's built-in search (-D pagefind_enabled=0), so live preview doesn't re-index on every save.file://. Preview withpython3 -m http.server --directory build/html.Dependencies
.. meta::fields (3di | Enhance metadata #6981). Pages without them are still searchable, just not filterable.make multiversioncan run the Pagefind step.Testing
make htmlpython3 -m http.server --directory build/htmland openhttp://127.0.0.1:8000.search.html.python -m pytest test/test_pagefind_config.py test/test_pagefind_meta.pyChanges
pagefind.yml: Pagefind CLI options plus search UI settings (filters and their labels, always-shown filters, breadcrumbs, result metadata, excerpt length).plugins/pagefind_config.py: loadspagefind.ymlinto Sphinx settings; adds thepagefind_enabledswitch.plugins/pagefind_meta.py: emits filter and SEO<meta>tags and breadcrumb metadata, and passes the search settings to the page templates.source/_static/pagefind-search.js(search UI behaviour) andsource/_static/pagefind-docsearch.css.layout.html,search.html,searchbox.html,pagefind-search.htmlandpagefind-searchbox.html.test/test_pagefind_config.pyandtest/test_pagefind_meta.py.Makefile(pagefindtarget;htmlandmultiversionrun it;servekeeps Sphinx search),conf.py(register the extensions),requirements.txt(PyYAML),.github/workflows/test.yml(Node setup) andREADME.md.conf.py:PRODUCTmacro set toROSand defined for multiversion builds.Did you use Generative AI?
Yes - Cursor IDE using models Composer 2.5, Grok 4.7, and Anthropic Opus 5.
Additional Information
Issue: #6991 | #6981
This is an automatic backport of pull request #7318 done by Mergify.