Hugo

Search works locally but not on domain

Hi
im using Hugo Learn theme and in my config.toml file i’ve put the following lines of code

baseURL = "https://domain.com/"
languageCode = "en-us"
title = "Documentation"
theme = "learn"

[params]
  # Change default color scheme with a variant one. Can be "red", "blue", "green".
  themeVariant = "mine"
  
[outputs]
	home = [ "HTML", "RSS", "JSON"]

everything works fine except the search functionality. It works fine on localhost:1313 but when i run the command “hugo -D” and upload the whole public folder on my server the search functionality isnt working

any tips?

thanks

There are many places for things to go wrong from your description. Help us out with some more info.

  • what steps do you take to upload your site to your server?
  • what server do you use?
  • on your live site, are there any errors logged in the DevTools console?
  • when you say that search functionality does not work, what does that mean exactly? Be specific
  • hugo -D to create the public folder and then upload it on server
  • dedicated server from server4you, linux OS with plesk
  • Errors : https://i.imgur.com/wGYlLc3.png
  • it functions like its doing CTRL F, not giving results below

the issue is that the site is not HTTPS although my servers/domains settings force https.

do i need to specify it somewhere maybe? the baseurl is “https://domain.com/” .

thanks

Your errors screenshot is too pixelated for me to view. Paste the full error messages instead.

1st error : Access to XMLHttpRequest at ‘https:// domain.com/docs/index.json’ from origin ‘http:// domain.com’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

2nd error : Error getting Hugo index file: error,

the domain is https but that particular folder loads by default without https if i put in front of the domain https:// www. it will work fine

@patriotaki your issue is such you’ll need to follow the steps at Requesting Help and share a project with us. You are trying to hide the domain of your site from this discussion, but if your issue is a slight typo of the domain or some other issue, we’ll never figure it out talking like this. Please follow the advice in that thread.