nextra-docs-template icon indicating copy to clipboard operation
nextra-docs-template copied to clipboard

Searchbar is not working

Open dscampero opened this issue 2 years ago • 5 comments

I have cloned the Doc Template shared in Github and I have noticed that it is not working. When I write to search for something the application does not show anything other than the first page (Introduction, etc...) However, in the demo version deployed in Vercel it does work. Can someone help me solve this problem?

dscampero avatar Jan 12 '24 19:01 dscampero

The search function searches only if all the pages are compiled, which is not the case when you're running the development server, and explains why it works on Vercel.

If you build your application locally and boot it with npm run start rather than npm run dev, you'll see it working locally too.

Fedec96 avatar Jun 07 '24 11:06 Fedec96

The search function searches only if all the pages are compiled, which is not the case when you're running the development server, and explains why it works on Vercel.

If you build your application locally and boot it with npm run start rather than npm run dev, you'll see it working locally too.

Did not work for me. I have around 80 pages, specific documentation with different methods. Search finds some previously created pages, but does not see new ones. Yet I see SSG works fine and I've HTML/JS chunks in .next/server/pages folder.

liringlas avatar Jun 27 '24 07:06 liringlas

It seems that for some reason no data being passed into chunks/nextra-data-en-US.json` for new pages. Any idea why that could happen? Pages on SSG are fully populated with content.

Screenshot 2024-06-27 at 12 26 59

liringlas avatar Jun 27 '24 07:06 liringlas

Did not work for me. I have around 80 pages, specific documentation with different methods. Search finds some previously created pages, but does not see new ones. Yet I see SSG works fine and I've HTML/JS chunks in .next/server/pages folder.

One thing you could consider trying is removing the node_modules & .next folders and re-run npm i before building and starting. Might be something related to cache. I have automated this process by creating a pre-build script (TS + esno).

Fedec96 avatar Jun 27 '24 07:06 Fedec96

Did not work for me. I have around 80 pages, specific documentation with different methods. Search finds some previously created pages, but does not see new ones. Yet I see SSG works fine and I've HTML/JS chunks in .next/server/pages folder.

One thing you could consider trying is removing the node_modules & .next folders and re-run npm i before building and starting. Might be something related to cache. I have automated this process by creating a pre-build script (TS + esno).

Looks like pure on-page Markdown content is being parsed and okay for search and nextra-data. However I have .tsx components rendered on the whole page, and they seem to be omitted by search/nextra data json.

Any known way to make React components content on MDX page also be searchable?

liringlas avatar Jun 27 '24 08:06 liringlas