-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
flexsearch ignores baseURL path leading to 404s #363
Comments
hmm, i think i tracked this down to hugo-book/assets/search-data.json Line 9 in c4d6963
Weird thing is that as far as i understand from the hugo docs, this should already include baseURL if i set canonifyURLs , no?
Anyhow, after replacing this with Not sure this is the best fix though, maybe it would be smarter to prefix the baseURL in js when showing the results? |
Hi! if you clone repo and run hugo on example site as
At least ot works as expected for me. |
hmm, i guess if you cannot reproduce then the problem is probably on our side somewhere... closing this for now, fix is above if others should stumble over the same problem... our
|
Well, sorry folks to "resurrect" this one. I'm having the same issue. I do have a GitLab Page that is hosted on baseURL: https://user.pages.domain.com/docs
canonifyURLs: true And I need/want to use ![My image][/images/my-image.png] (Doesn't matter if I cant to So, I was digging into the theme code, and I found and also came to this issue, and I found that @joernhees came to the same solution that I came up with... Just to replace the: Line 8 in d5b75f4
With: const searchDataURL = '{{ $searchData.Permalink }}'; Solves the issues for all cases (I mean, you are still now able to use: relativeURLs: true
canonifyURLs: false 'Cause, it will break some theme assets loading, but all other combinations seem to work... So, I'm submitting a PR to change this line. |
Thanks for this nice theme, which we use to render some docs. In our case it ends up in some subdir of a larger page http://example.org/subdir/XYZ .
Today we noticed that search in our case works only until you actually click on one of the results... problem seems to be that the generated search result links don't include the path up to subdir (they point to http://example.org/XYZ ) leading to 404 errors.
So we started experimenting with
baseURL
(=""
or="http://example.org/subdir/"
),relativeURLs
andcanonifyURLs
. We actually tried all combinations, none worked. Some don't find the flexsearch json files it seems, but if they exists, opening them reveals that the links in there are absolute (but host local) links (so they just point to/XYZ
), which works if you're served from the root dir and not a subdir.maybe related #333
The text was updated successfully, but these errors were encountered: