Drupal 8: Missing Login

Drupal 8: What happened to my login page!?

The Short

If you are working on the page.html.twig file and you now can’t get to the login screen confirm you are rendering the content section in your template by having {{ page.content }} in the page.html.twig file.

The Long

Recently, I have been learning to use Drupal 8 while at the same time getting more and more familiar with Drupal 7. I hit a little problem along the way and thought I would share as Drupal is notoriously hard to find information on when you need it. Unfortunately, part of the reason why is because if you read the documentation you can figure it out with some effort.

Who wants to put that kind of effort into it when it seems like there is a simple fix? So here is a simple fix or something you can check if you have a similar problem.

What I was doing…

I was in the process of building a custom theme and was building a template using YOURTHEME/templates/page.html.twig.

After logging out I was unable to log back in. I tried logging in via the login path built into Drupal 8 (mysite.com/user/login). It came up with the same page as the main page I was working on. I determined the template was the problem by renaming the template so as not to be rendered by Drupal. Note you can’t clear the cache if you can’t login. You will have to run the drush in the command line in the root folder (the folder with sites in it…) of your site: drush cr. Now the login page work by going to mysite.com/user/login.

The problem was that I had defined the content area in the MYTHEME.info.yml but did not add the code to the template to render the content in the content area of my theme. To resolve enter {{ page.content }} where you want to render your login information in your theme. Clear the all caches and change the name of the template back to what it was (page.html.twig).