-
-
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
Search not only in .md's #795
Comments
The search is powered by lunr.js, which is a client-side search tool that works by building a search index based on the provided content. By default, lunr only searches html pages that include the lunr javascript. When you enable search in the config, just-the-docs includes this js in all of your markdown pages (rendered to html) unless you opt the specific page out of search.
How are you actually displaying the json to the user? Is it rendered in an html page? Are you letting them download the json directly? Regardless, what you want to do may be possible by writing your own javascript that uses the lunr api to add content from the json files to the search index. |
It looks like lunr.js crawls the pages before the json files are rendered in a html page. See for example: search-data.json looks like this for this page: No rendered json in the content variable. |
Yes that seems correct. (Reithose and I are working both for same site). Can we somehow prerender or give the crawler a different timing? |
Going to mark this as needs investigation. A PR is certainly wecome. |
This issue is due to a Jekyll regression in v4.2.0. To check, run |
@FlarosOverfield Thanks for following up on this issue. Looking at @Zuijdam and @reithose's site, https://www.dedigitaletuin.nl/assets/js/search-data.json contains entirely unrendered content; as @dcchambers explained, this is not the expected behaviour! To investigate this further, we'll need the url of the source file repository or (better) a minimal working example. |
@FlarosOverfield thanks, that helps: Jekyll converts Markdown+Liquid files to HTML if and only if they start with front matter. Unless you want to use a special layout, you should start all1 ---
layout: default
--- Moreover, links to pages appear in the navigation panel only if they have also have a Footnotes
|
@Zuijdam @reithose The issue you reported is due to a regression in Jekyll v4.2.0 that causes generation of In your gem "jekyll", "~> 4.2.0" Your checked-in Running |
Thx! We will try this.
…On 20 Aug 2022, 11:33 +0200, Peter Mosses ***@***.***>, wrote:
@Zuijdam @reithose The issue you reported is due to a regression in Jekyll v4.2.0 that causes generation of /assets/js/search-data.json before all the html pages have been rendered.
In your Gemfile you've specified:
gem "jekyll", "~> 4.2.0"
Your checked-in Gemfile.lock also specifies jekyll (4.2.0). GitHub Pages runs bundle install, which respects the settings in Gemfile.lock. Running bundle update ignores Gemfile.lock, and should (currently) update Jekyll to v4.2.2.
Running bundle update works for me, testing locally on a download of your repository. You should commit the changes to Gemfile.lock after running bundle update. If that doesn't fix the search data on your published site, I'll be happy to take another look at your issue.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Your solution fixed the problem! geensnor/DigitaleTuin@a725a7d Thanks for your help! |
Good to know that using However, I wrote:
That's inaccurate: GitHub Pages uses Jekyll 3 when it builds a website directly from a branch, regardless of the |
BTW, See #925 for how to start using Zoek {{site.title}} I've tested it locally – I hope it works for you too. |
A related issue: is it possible to index YAML frontmatter for lunr.js? Because of complicated layouts and the use of Netlify CMS, I store a lot of page content in the frontmatter. I'd love for this to be indexed. |
The Liquid code that constructs the search index is at /assets/js/zzzz-search-data.json. It refers to specific items of front matter, such as It should be possible to extend the code to construct lunr.js index entries from all other items of front matter. How easy it would be depends on what kind of strings you use – and on how familiar you are with Liquid… I suggest to submit this issue as an enhancement proposal, indicating whether you're planning to implement it yourself. |
I actually managed this soon after I posted my comment -- it was fairly straightforward to add yaml values to |
Frontmatter content related #1067 |
Is your feature request related to a problem? Please describe.
We have a site with markdown pages but also some json files we show with data. The search in not searching in the json's
Describe the solution you'd like
A way to alter the search scope so it will find everything we write/make.
Describe alternatives you've considered
no clue how to fix this
The text was updated successfully, but these errors were encountered: