-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Custom content (e.g. front matter) added to Lunr search index #1067
Labels
Comments
diablodale
added a commit
to diablodale/just-the-docs
that referenced
this issue
Dec 19, 2022
- add framework for custom content into Lunr indices
More of my content is frontmatter/data driven and NOT below the
|
diablodale
added a commit
to diablodale/just-the-docs
that referenced
this issue
Jan 9, 2023
- add framework for custom content into Lunr indices - update docs for this feature
mattxwang
added a commit
that referenced
this issue
Jan 14, 2023
This is a prototype for review and discussion. My use and testing of this PR is on top of 6d9d413. The changes are trival to rebase to `main` and I'm happy to do so if this prototype moves forward. * Feature request details in linked issue, fixes #1067 * I welcome feedback and all discussion * A draft doc site of mine using this PR is at https://docs.hidale.com/ To use the prototype, the two include files need to be customized. Here are mine from the draft website diablodale/dp.docs@9c0d836 Co-authored-by: Matt Wang <matt@matthewwang.me>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
JTD creates
search-data.json
for Lunr only from thepage.content
,page.title
, and sometimes headers (which are already in the page.content). This misses all the information/content that is in Front Matter, data files, etc.I use JTD to render highly structured content by a combination of Front Matter custom attributes and a page's content (that text content that is below the Front Matter). Many of my rendered pages have half of their rendered html sourced from my Front Matter attributes. Therefore, the Lunr search index is missing a large amount of my content.
The Ask -- What to build?
easily "pluggable" method to add their custom data into Lunr's index
Proposal
I've written a working prototype, PR forthcoming.
Three code blocks need to change
search-data.json
for Lunr's indexThis can be achieved by...
{% include lunr-data.json page=page %}
toassets/js/zzzz-search-data.json
so that a user can writecustom code to gather and insert their custom content/data into the JSON. Update rake also.
{% include lunr-index.js %}
toassets/js/just-the-docs.js
so that a user can write custom codeto load their custom JSON into the runtime Lunr index. My prototype supports adding custom data into
already existing indices (e.g.
content
). Support for new custom Lunr indices seems not valuable given complexity.To do so requires a 3rd include file or something in site config.
lunr-xxx
include files to JTD theme -- the default setup has therefore no change in behavior.Related discussions
olivernn/lunr.js#100
https://katydecorah.com/code/lunr-and-jekyll/
The text was updated successfully, but these errors were encountered: