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?
There’s two different ways** to use Hugo to run a website on the internet:
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.
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.