-
-
Notifications
You must be signed in to change notification settings - Fork 355
feat(flexsearch): search in all headings #740
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ Deploy Preview for hugo-hextra ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
14254cc to
a457b68
Compare
a457b68 to
229da50
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR! It looks good overall.
My only suggestion is to use PAGE.Store instead of scratch.
| @@ -0,0 +1,31 @@ | |||
| {{- /* | |||
| Extracts all headings from a page and adds them to the scratchpad. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scratch has been deprecated: https://gohugo.io/methods/page/scratch/
Deprecated in v0.138.0
Use the PAGE.Store method instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PAGE.Scratch is deprecated, not newScratch (maps.Scratch):
PAGE.Scratchis a property ofPagereplaced withPAGE.Store.PAGE.Storeis a property ofPageand amaps.Scratchwith the scope of the page.collections.NewScratchis a locally scoped instance ofmaps.Scratch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i see, thanks
|
looks good on https://imfing.github.io/hextra/versions/latest/
|

This PR allows the search to find the right section by parsing all the headings.
For example, if you are looking for "logo" inside the example site, the search will give you
#nagivation.This is right, but not what exactly you are looking for (
#logo-and-title).FYI,
utils/extract-headings.htmlis a recursive partial.The size of
search-data.jsonis nearly the same because it contains the same content, but it is split differently, with only some keys added.Related to #169
I also fixed a regression from c11c3c3