Hugo-based website deployed on Netlify

Hello. I deployed my first Hugo website to Netlify. It is just a test
https://github.com/zoliky/hugotest/tree/master/web/hugo

I can’t wrap my head around the “publishDir” option. If I understood correctly it is set to “public” by default. What purpose does that “public” directory have? The documentation says:

The directory to where Hugo will write the final static site (the HTML files etc.).

I might be stupid but I still don’t get it. I don’t have a “public” folder in my repository yet my website builds and displays well. Do I need that “public” folder?

I would be grateful for any suggestion.

There’s two different ways** to use Hugo to run a website on the internet:

  1. Use Hugo to build the site on your development machine (i.e. run hugo on your desktop/laptop) and then upload everything in /public to a web server.
  2. Use a fancy automated deployment system like Netlify, which keeps an eye on your git repository, and then anytime there’s a chance, it will build your website.

Since you’re doing option 2, you don’t need to put /public into your git repository, because Netlify runs hugo and builds it for you.

** There’s probably more than two ways, but this is to make things simple.