Hide Admin Path on Deployment in NetlifyCMS

In this article we will learn how to hide admin path / route on deployment in Netlify CMS.

In Netlify CMS, we are provided with the/admin route to access the admin dashboard. And we have to configure all the properties of the admin in our config.yml file in our repository.

We can only access the admin when we build and deploy the site on netlify.

However it would be a better to hide our admin path / route when the site is live for some obvious reasons.

So follow the steps below to hide the admin path on deployment.

Step 1 : Firstly, to hide the admin path when the site is deployed and live, we have know how to run admin locally. Because once we hide the path we wont be able to access it after deployment.

Follow the guide here : Run Netlify CMS admin locally

Step 2 : Once you are done with the first step , now all you have to do is to put the admin/index.html in your .gitignore file in your root directory.

Step 3 : Commit and push your changes on git. Now netlify will build and deploy your site without the admin path.


If you have already add the file (admin/index.html) in your github repository and then adding the path to .gitignore file, then the folder will not be ignored by git.

To fix it you have to remove it by :

git rm -r --cached  directory_name

Here, directory_name will be admin/index.html. And then git add . and commit and push your files.

Related Topics:

How to make list of objects in Netlify CMS using list and object Widget

Fixed Your Git Gateway backend is not returning valid settings Error on Netlify

Scroll to Top