Hugo -D generates broken site

Hi, So I found out about Hugo a few months and wanted to make a few websites with it one of them is hosted on Netify and the other one I want to host on my web hosting since it will be a subdomain so in the Quick Start section at the end it tells us to run hugo -D to generate static site but this is what it generates but the same site works fine on Netlify

did you directly open the html files from your filemanager and view it in browser?

you need the server to serve the static site, try: hugo server -D

I need to generate static files to host on a shared hosting

yes i know, but in local developement mode, you need a server to serve the static site. that’s why you need to run hugo server -D,

because you said that the site in netlify works correctly, because it’s hosted/served by netlify.

So what I will upload the public folder to my shared hosting it will work fine there?

as long as you set the baseURL correctly, then yes it’s going to work.

if you want to generate the site for your shared hosting, and the baseURL is different from the netlify hosted one, you just need to change the baseURL via config of -b flag

for netlify hosted one:

hugo -D -b

for the shared hosting:

hugo -D -b
1 Like

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