Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hugo not rendering the public folder locally

When I use the command hugo, it generates the index.html in the Public folder. When I open index.html, the site load like this:

But when I use the hugo serve command locally, it generates the link http://localhost:1313/, and the site load properly. It loads like this:

I think the problem is because of the not proper rendering of files or anything similar.

My approach:

  • I added the code relativeURLs = true and uglyURLs = true at top of the config.toml file but still it does not rendered properly.
  • I had set baseurl = "/" in config.toml file but this also does not work.
like image 717
Rajiv Singh Avatar asked Mar 18 '19 22:03

Rajiv Singh


1 Answers

Your theme might be loading CSS using {{ .Site.Baseurl }}.

For example:

<link rel="stylesheet" href="{{ .Site.BaseURL }}css/style.css">

In that case, make sure that the BaseUrl defined at the top of your config.toml file is set to http://localhost:1313, which will allow your local server to find the CSS file.

like image 68
octothorpe_not_hashtag Avatar answered Oct 24 '22 07:10

octothorpe_not_hashtag