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

Searching _posts #1421

Open
electriquo opened this issue Jan 30, 2024 · 1 comment
Open

Searching _posts #1421

electriquo opened this issue Jan 30, 2024 · 1 comment

Comments

@electriquo
Copy link

Describe the bug
The search for words within posts returns empty.

To Reproduce
Steps to reproduce the behavior:

  1. Create a post
  2. Publish the post
  3. Verify the post is shown in the browser
  4. Use the search box to search for words (not in headers) within the post

Expected behavior
Be able to search within posts.

Screenshots
image

Desktop (please complete the following information):

  • OS: macOS
  • Browser Chromium
  • Version 123.0.6271.0

Additional context
#706

@electriquo electriquo added the bug label Jan 30, 2024
@mattxwang
Copy link
Member

Thanks for making an issue @electriquo! Hm, this surprises me slightly, but it's also true that we don't test _posts rigorously as part of our test suite.

I'm happy to look into a more permanent solution in the long-term, but in the interest of unblocking you: I believe (but have not personally tested) that explicitly adding posts to the JtD collections key may resolve your problem:

# within your _config.yml
just_the_docs:
  collections:
    posts: 
      name: Posts

For context on why this may work, these lines control the collections that are added to the search index:

{%- if site.just_the_docs.collections -%}
{%- for collection_entry in site.just_the_docs.collections -%}

So, the above snippet explicitly adds the posts collection to the what we iterate over.

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

No branches or pull requests

2 participants