Skip to content
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-data.json does not resolve included content #655

Closed
PhilLab opened this issue May 23, 2021 · 3 comments
Closed

search-data.json does not resolve included content #655

PhilLab opened this issue May 23, 2021 · 3 comments

Comments

@PhilLab
Copy link

PhilLab commented May 23, 2021

Describe the bug
If one of your content files includes other content via {% include %} the search data JSON file does not reflect this.

To Reproduce
Steps to reproduce the behavior:

  1. Have a content file like this:
---
title: My title
---
{% include IncludeMe.md %}
  1. Inspect the generated search-data.json at /_size/assets/js/search_data.json
  2. The file contains:
{"0": {
    "doc": "My title",
    "title": "My title",
    "content": "{% include IncludeMe.md %} ",
    "url": "/10.html",
    "relUrl": "/10.html"
  }
...
  1. As a result, the search does not return the file when searching for the included content

Expected behavior
The content included from IncludeMe.md should turn up in the search-data.json

@PhilLab PhilLab added the bug label May 23, 2021
@pdmosses
Copy link
Contributor

pdmosses commented May 27, 2021

It appears that Jekyll renders pages in alphabetical order, see also this clarification. @SgtSilvio wrote:

Jekyll evaluates files in alphabetical order.
So before when it was called search-data.json pages that started with a letter t or alphabetically greater were not rendered > to html yet, so their plain md was included in the search-data.json

That is why the generating file has the prefix zzzz-. I know very little about Jekyll or Ruby, but it's conceivable that more than one thread is used for rendering pages. Then the rendering of zzzz-search-data.json may start before that of other pages has finished. It's unclear to me whether there is an alternative (thread-safe) way of generating the search data using Jekyll.

On a moderately large site that makes use of included md files, the reported bug affects my generated search data when the site is built locally with jekyll@4.2, but not when using jekyll@3.8.7. By default, GH Pages still uses jekyll@3.8 🙄, so the bug might not appear on most published sites. However, I'm using GH Actions and jekyll@4.2 to build on GH Pages, and indeed, the bug shows up on the published site.

@pdmosses
Copy link
Contributor

pdmosses commented Jul 2, 2022

This was due to a Jekyll regression, not a bug in Just the Docs.

See my Jekyll issue comment for further details.

@pdmosses
Copy link
Contributor

The Jekyll v4.2.0 regression that caused this issue has been fixed.

If it reappears, please reopen, mentioning the Jekyll version used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants