Hugo site doesn't work in hosting well

Hi folks! Help please I can not undestand why my hugo site doesn’t work in normal hosting. Actually works but there is stylesheet are not connected. I just frustrated. In my localhost everything ok. And I newbie in command line

here is it [site address] (http://cosmos-factory.ru)

[and same in Github] (https://cosmos-factory.github.io/factory/)

[Here is content my public in github repo] (https://github.com/cosmos-factory/cosmos-factory.github.io/tree/master/factory)

Hi there,

We would really need your Hugo project source code in order to help. Generated public dir is not really helpful.

I suspect it’s a mixed content issue

You are using http (non-secure) but in the CSS source You are using https

<link rel="stylesheet" href="https://cosmos-factory.ru/styles/main.css" type="text/css">

try use http (baseURL in the site config) instead https

1 Like

No. Calling https assets from a http domain does not cause problems. It’s the opposite that will throw browser warnings about mixed content.

Something else is causing the original poster’s stylesheet to be 404.

But without the source code it’s difficult to see what’s wrong.

It does work in hosting well. Share your project source (what you shared are the “output” folders which is not what is needed). Off the cuff, check that baseurl is set correctly in your config, and that the path for your css is correct.

If your baseurl is http://mysite.com, and your web server has a folder “mysite_public” that maps to that, you upload the content of the public folder that comes from the hugo command, into “mysite_public”, not the folder itself.

If on the other hand you want baseurl as http://mysite.com/somefolder, then you upload the content of your public folder to mysite_public/somefolder.

Hi all, I just put my whole Hugo project in [Githup repo] (https://github.com/cosmos-factory/cosmos-factory.github.io/tree/master/factory)

You’ve got baseURL = "https://cosmos-factory.ru" in your config, but your site is httP://.

Your css is being referenced at <link rel="stylesheet" href="https://cosmos-factory.ru/styles/main.css" type="text/css"> but, I don’t see any styles folder in your project’s static, although that could be from a theme…

What do I need to do for styles gets into static ? May I put that with my hands?

And what about that I have css files in styles folder inside public?

You can put things into static yes. It’s for any static files. The static/ is loaded at the root of your site. When I tried accessing https://cosmos-factory.ru/styles/main.css, I got a 404. You should not add anything to public after hugo builds it, but rather just let hugo build / control everything.

But I have static outside of public and there is (in static) only images and nothing more :thinking:

The static contents will get added to public when you generate the site. The css can come from your theme as well. I’m not sure what you are using.

The content of this folder:

https://github.com/cosmos-factory/cosmos-factory.github.io/tree/master/factory/public

… should be what you upload to whatever your hosting directory is. This has the css.