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

The Search Spinner Keeps Spinning And No Result Appear #566

Closed
Qian-Donglin opened this issue Nov 8, 2023 · 4 comments
Closed

The Search Spinner Keeps Spinning And No Result Appear #566

Qian-Donglin opened this issue Nov 8, 2023 · 4 comments

Comments

@Qian-Donglin
Copy link

First of all, thank you for making this fantastic theme!

Now I use hugo-book theme, and suddenly I found I cannot use the search. My customization is only add katex for using $$ to represents the numerical formula on hugo-book/layouts/partials/docs/html-head.html. The added code is following.

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.8/dist/katex.min.css"
	integrity="sha384-GvrOXuhMATgEsSwCs4smul74iXGOixntILdUW9XmUC6+HX0sLNAK3q71HotJqlAn" crossorigin="anonymous">


<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.8/dist/katex.min.js"
	integrity="sha384-cpW21h6RZv/phavutF+AuVYrr+dA8xD9zs6FwLpaCct6O9ctzYFfFr4dgmgccOTx"
	crossorigin="anonymous"></script>


<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.8/dist/contrib/auto-render.min.js"
	integrity="sha384-+VBxd3r6XgURycqtZ117nYw44OOcIax56Z4dCRWbxyPt0Koah1uHoK0o4+/RRE05" crossorigin="anonymous"
	onload="renderMathInElement(document.body);"></script>

<script>
	document.addEventListener("DOMContentLoaded", function () {
		renderMathInElement(
			document.body,
			{
				delimiters: [
					{ left: "$$", right: "$$", display: true },
					{ left: "\\[", right: "\\]", display: true },
					{ left: "$", right: "$", display: false },
					{ left: "\\(", right: "\\)", display: false }
				]
			});
	});
</script>

And I hit on this problem in both of my local and github pages. Are there someone knowing how to resolve it?

image
@alex-shpak
Copy link
Owner

Hi!
do you see some error in browser console? what is your --baseURL when you build the site?

@millionhz
Copy link

I have the same issue. Here are my findings:

My website is hosted on github pages so the baseURL is of form: username.github.io/website

In order to retrieve assets the hugo page makes request to username.github.io/website but for search date the page is making request to username.github.io/en.search-data.json instead of username.github.io/website/en.search-data.json

@millionhz
Copy link

See #571 and #505

@alex-shpak
Copy link
Owner

Closing in favour of #505

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

No branches or pull requests

3 participants