docusaurus-lunr-search icon indicating copy to clipboard operation
docusaurus-lunr-search copied to clipboard

Anchor tag does not have correct URL for opening results in a new tab

Open evaera opened this issue 2 years ago • 1 comments

  1. Go to a page within a subfolder, like https://lelouch77.github.io/docusaurus-lunr-search-demo/docs/doc1 on this project's own demo site
  2. Search something like "welcome", which will link to the blog section
  3. Middle-mouse click it, or look at the browser hover in the bottom left: image

The URL is wrong.

Expected: https://lelouch77.github.io/docusaurus-lunr-search-demo/blog/welcome Actual: https://lelouch77.github.io/docusaurus-lunr-search-demo/docs/blog/welcome

evaera avatar Jun 29 '22 23:06 evaera

Related issue from my project (which depends on this project) where a user reported this: https://github.com/evaera/moonwave/issues/116

evaera avatar Jun 29 '22 23:06 evaera

Have same issue

efectn avatar Nov 14 '22 15:11 efectn

Having the same issue with latest version of docusaurus-lunr-search.

I reverted to v2.1.15 and it works properly with this version.

val1984 avatar Feb 10 '23 13:02 val1984

@val1984, probably you should just update docusaurus to latest version in order to make docusaurus-lunr-search work fine with version later than 2.1.15

Lullabyq avatar Mar 01 '23 16:03 Lullabyq

@Lullabyq This is with the latest stable version of Docusaurus: v2.3.1.

val1984 avatar Mar 01 '23 16:03 val1984

ok, i have another guess, have you swizzled SearchBar component?

you can check it easily in src/theme, SearchBar folder should not be there

Lullabyq avatar Mar 02 '23 07:03 Lullabyq

@Lullabyq Thank you, I reran the swizzling command from the docs and now the URLs are correct!

@evaera @efectn Can you try re-running the swizzling command from the docs?

npm run swizzle docusaurus-lunr-search SearchBar -- --eject --danger

Or if you're using pnpm like me:

pnpm swizzle docusaurus-lunr-search SearchBar --eject --danger

val1984 avatar Mar 02 '23 09:03 val1984

fixed in new version, try 3.1.0 https://praveenn77.github.io/docusaurus-lunr-search-demo/

Note!: Delete your themes/SearchBar folder before upgrading version. And swizzle is no more needed

praveenn77 avatar Oct 15 '23 16:10 praveenn77