Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Stardard search results are empty when baseURL has a path #2985

Closed
2 tasks done
danikiev opened this issue Sep 6, 2023 · 4 comments
Closed
2 tasks done

Stardard search results are empty when baseURL has a path #2985

danikiev opened this issue Sep 6, 2023 · 4 comments

Comments

@danikiev
Copy link

danikiev commented Sep 6, 2023

Preliminary Checks

Description

In starter-hugo-academic if I change baseURL in config.yaml to https://example.com/test/, the default wowchemy search produces empty results.

Earlier it was working (wowchemy 4.8)

Reproduction Link

https://github.com/wowchemy/starter-hugo-academic

Steps to Reproduce

  1. Clone the starter-hugo-academic:
git clone https://github.com/wowchemy/starter-hugo-academic.git
  1. Change baseURL to an address with path, e.g. change line 7 of the file config/_default/config.yaml to baseURL: 'https://example.com/test/'
  2. Serve the website with hugo server
  3. Search for 'welcome'

Expected Result

2 results

Actual Result

Search results are empty

What Hugo Module versions does your site use?

module github.com/wowchemy/starter-hugo-academic

go 1.15

require (
github.com/wowchemy/wowchemy-hugo-themes/modules/wowchemy-plugin-netlify v1.0.0 // indirect
github.com/wowchemy/wowchemy-hugo-themes/modules/wowchemy-plugin-netlify-cms v1.0.0 // indirect
github.com/wowchemy/wowchemy-hugo-themes/modules/wowchemy-plugin-reveal v1.0.0 // indirect
github.com/wowchemy/wowchemy-hugo-themes/modules/wowchemy/v5 v5.8.1
)

What operating system(s) are you seeing the problem on?

Windows, Linux

What browser(s) are you seeing the problem on?

Chrome, Firefox

Which Wowchemy template are you using?

starter-hugo-academic

What version of Hugo are you using?

hugo extended v0.115.4

@valette
Copy link
Contributor

valette commented Sep 14, 2023

it seems that index.json is not loaded (404 error) due to its URL set to the root adress of baseURL, without the complete path.

@danikiev
Copy link
Author

I don't see any path without /test/ in index.json.

And also it loads if I enter http://localhost:1313/test/index.json

@valette
Copy link
Contributor

valette commented Sep 15, 2023

I don't see any path without /test/ in index.json.

And also it loads if I enter http://localhost:1313/test/index.json

yes, the issue is not the content of index.json. And index.json is present at its correct URL. The problem comes from trying to load index.json with incomplete URL (without the "/test/" subpath). Most probably the issue comes from here:
https://github.com/wowchemy/wowchemy-hugo-themes/blob/f47bd809f7688507f4144f9592da038d56542ef3/modules/wowchemy/layouts/partials/site_js.html?plain=1#L115

@danikiev
Copy link
Author

Oh, you are right. Changing it manually there to "/test/index.json" fixes the search. Not sure how to provide the correct path from a variable...

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

No branches or pull requests

2 participants