1

The docs say: https://docs.netlify.com/configure-builds/overview/

Publish directory: Directory (relative to the root of your repo) that contains the deploy-ready HTML files and assets generated by the build. If a base directory has been specified, it should be included in the publish directory path. For example, if your base directory is set to site, the publish directory should include the site/ prefix like so: site/public. Visit the common configurations doc to learn about typical settings for popular tools and architectures.

My question, why do I care what the directory is suppose to be? Isn't it all auto-generated somewhere?!

enter image description here

mfaani
  • 33,269
  • 19
  • 164
  • 293

1 Answers1

2

You're absolutely correct. The publish directory is automatically generated for each SSG (Static Site Generator). Now there are 2 reasons, why you need to specify it:

Reason 1

The default publish directory for each SSG is different. For example,

  • for Hugo it's public
  • for Jekyll it's _site

so on & so forth for each SSG.

Reason 2

All these SSGs allow you to change the default name of the publish directory as well. For example,

  • in Hugo, you can change the publish directory using --destination flag
  • in Jekyll, you can do so using --destination flag

So, how does Nelify know what's the name of your publish directory ? Therefore it becomes necessary to specify the publish directory based on your SSG & your setup.

Sidharth R
  • 388
  • 1
  • 9
  • 1
    Thanks. Why would one need to change the default directory though? Like if you're using Hugo, why not let it always just be `public`. Is this just giving us more control to do whatever we want? – mfaani Jan 03 '22 at 21:14
  • 1
    That's obviously the choice of the programmer. At least I have never felt the need to change it. But who knows it might be required in some setup or environment or deployment config right ? As you said, the main idea is to give us more control to do whatever we want. – Sidharth R Jan 04 '22 at 03:04