How to deploy hugo to surge.sh

So I am trying to deploy my website to surge.sh

I’ve succesfully done this before with nuxt and vuepress,
usually its just building the site and then surge dist\

In hugos case i ran these commands:

hugo
surge public\ mydomain

It succesfully deployed yeah, but all of my css and js everything is broken and nothing works.

I am using this theme -> https://themes.gohugo.io/freelancer/

What am i doing wrong here?

My website works fine locally when i run hugo server

I looked at my site and it gives me 404 errors, that It cannot find any of my Js or css files or any other files, though when i look in my public folder, everything seems to be in there.

i dont get it.

I tried deploying my site to Render and the same issue occured.

after some testing i found my server was giving errors when i started it up:

 Building sites … WARN 2020/03/27 18:40:19 found no layout file for "HTML" for kind "taxonomyTerm": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2020/03/27 18:40:19 found no layout file for "HTML" for kind "taxonomyTerm": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2020/03/27 18:40:19 Page.Hugo is deprecated and will be removed in a future release. Use the global hugo function.

I’ve seen these before, the question is is that, i dont think they would affect deployment, considering everything works in a local server, why wouldnt it work there?

I am completely lost.

I tested this on a fresh install of the theme and the error persist, thus It must be that the whole theme is faulty.

When I look at the deployed site i see,
favicon is registered, images are registered, content is registered, my own css is registered

BUT it doesnt seem to register any JS nor the bootstrap css.

How and why? Since it is working in localhost then why isnt it in deployment?

So I’ve investigate the folder structure a bit and found that the sites that deployed correctly have _default in the layouts folder, where as this whole theme is missing it.

So I got my initial warns fixed by adding a _default folder with single;baseof and list, files added to them, all of those files are empty though.

The error my domain site shows is this : net::ERR_CERT_COMMON_NAME_INVALID

and that Jquery isnt defined.

Though all my links should be right.

And after a rigorous configuring, I found out the problem was in the BaseURL.

the theme provides a baseurl in which i blindedly added my domains site, turns out it was messing around with the all the pathing, so i switched it to just /

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.