Home
Support Forums

Netlify.toml location

Hi , there are some pre made templates of netlify.toml on github . But I only want security headers like x-frame-options and x-content-type-options . So , can I add only these 2 to 3 headers in netlify.toml or whole is necessary ?
Also , build directory is to be belonged to github url . So, only url of netlify.toml is required, right ? And netlify will read it directly. Because I have uploaded my file to netlify directly and not to github. And for build command is written for site settings, what should be written there ?
I am new to coding too.
Thanks

Hi @Asc

You only need add that data required for your site.

If you are uploading you are uploading your site using the drag and drop method of deploy, Netlify will not run the build process. Drag and drop is for sites that are already built. You can still use a netlify.toml file.

If your site requires building (for instance you are using React, Next.js, Vue, etc.) then you need to deploy with git by putting your code into git repository (e.g. with GitHub) then linking that repository to Netlify so it can build and deploy it.

In either case, the netlify.toml file will go in the root of your project.

An example repository is coelmay/netlify-drop-example which you could download to your computer and upload directly to Netlify using drag and drop, or coelmay/netlify-react-bare which you could clone and deploy to Netlify from Github.

1 Like