Hide Admin Path on Deployment in NetlifyCMS

featured Image

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.

Troubleshoot:

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

Related Posts

git commands with example

Top 40 Git commands with Examples

GitHub has become an essential tool for developers to manage, store, and collaborate with other developers on software projects. With its simple powerful git-based version control system, GitHub allows users…

Read more
Check GitHub Account in the Terminal

Check GitHub Account in the Terminal

GitHub is an integral tool for developers to store, manage, and collaborate on software projects with other developers. And as we work more and more in the command line it…

Read more
featured Image

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

Here in this Netlify CMS tutorial we will how easily we can make a list of objects using list and object widgets. This will allow us to add multiple objects…

Read more