Public folder - clarification needed

Hi everyone,

I have built a multiple-page website using Hugo and it works perfectly in development mode, even at this moment. However, when I put the public folder under the configured folder /var/www of nginx, adjusted nginx configuration to serve this static website locally, but then the this website just shows up with broken UI. Clicking on links does not show anything, instead the not found from nginx server.

I still do not understand about the issue but would like to have your help on following un-clear points:

  1. I inspected the public folder generated by hugo command and saw that except css, fonts, images and js folders, there is only 1 html file which is index.html given that I created many content pages and custom layout files for them as well.
    It looks like Hugo combines all the pages created by me into 1 index.html. I looked into the index.html and its content is not including content of the other pages at all.
    I wonder if it is the expected result?

  2. I created a couple of folders and files under Hugo content and layouts folders. Is it possible to make Hugo generate the website directory structure like the one I created?

My environment:
OS: Mac OS 10
Hugo: 0.53
Output of hugo env:

Hugo Static Site Generator v0.53/extended darwin/amd64 BuildDate: unknown
GOOS=“darwin”
GOARCH=“amd64”
GOVERSION="go1.11.4

Thanks,
Thai

Hi,

Can you check that your content files do not have draft: true set?

If that does not solve your problem, we will need to see your code to help: Requesting Help

Hi @pointyfar,

Checked and saw that the content files do have draft: true set. I set that to false, then re-built and re-deployed the website again and the issue is fixed.

Thanks for your help. If possible, can you please explain more how it is fixed :wink: since for me that tip is quite a hack.

Thai

Hi,

It’s not really a hack, it is working exactly as intended: https://gohugo.io/getting-started/usage/#draft-future-and-expired-content

Thanks for the information. Now I understand that part better.

It looked like a hack for me because I thought that when running hugo command to build production website, from end-user perspective, Hugo should automatically set the page attribute to released status or so. Anyway, things are clearer now.

Thai

I’m glad it is clearer. I wanted to add, the reason we do that is for flexibility. If you don’t want to use draft in your front matter, you don’t have to. It works really well for teams, for instance, or if you like to write and save your work in your content repo, you keep the draft until you are ready to publish a piece. But if you want every piece of your content to publish immediately, omit it from your archetypes. :slight_smile:

1 Like