Recommended Setup

Hi there! I’m quite excyted about switch to hugo for my needs. I already have lot of experiences with other CMS, but get frustrated over and over with them…

I installed HUGO on my OSX workstation, using homebrew, and also on my Debian Virtual Server, which I use exclusively for web development. I can use hugo on both, but it render correctly just on my OSX host. If I run hugo from the debian server, and acces my oublic folder from the main virtual domain (ex. myvirtualdomain/hugo/demosite/public) it display just unstyled content. If I run ‘hugo server’ from osx - I have a shared server folder, which I can use from both - it correctly render the style.
Now, i do not understand… isn’t supposed to be a static render? What I’m missing?
Isn’t supposed to just copy my public folder on my server and works?

Cheers,
Andrea

There are in general 2 ways to use hugo:

  • Run hugo server to spin up a simple web server to serve the website
  • Use hugo to generate the static content for your website, and then deploy these files on to an actual web server.

It would be good if we could understand which of these 2 setups you tried with your Debian Virtual Server. It would also be useful, if you could clarify what you mean by unstyled content.

Thanks for reply. Well, as I said, I run ‘hugo’ from my debian server, and it correctly seems to compile the site. Although, when I open the adress, ‘http://local.debian.server/path-to-my-site’, it’s unstyled. Just bare text… no template.
If I run ‘hugo server’ from my OSX host, it compile correctly he site and, when I go with my broswer to ‘http://localhost:1313’, it display the content styled, with all the templates design.

Any clue?

You are serving from a subdirectory. You need to make sure your css is linked using $baseURL and that $baseURL is properly set.

Even though Hugo is a static site generator, the path to the CSS files and any static resources will change if you try to access it using 'http://local.debian.server/path-to-my-site.

If you really want to access the files through the above URL, you need to set the BaseURL property in your config file (i.e. config.yaml or config.toml or config.json) to http://local.debian.server/path-to-my-site so that the static resources are served correctly.

Hugo would be unable to guess the relative URL path automatically if unset, and hence assumes that the public directory would be at the root of the webserver, which is not the case with your setup.