Score:0

My site is not reading the custom page--user--login.html.twig files I created

gi flag

I am creating custom user (login) pages for my Drupal 9 sites. I have ensured that the files follow the Twig naming conventions and are in the correct folder:

app/web/sites/site-name/themes/our-uikit-theme/templates/user/page--user--login.html.twig

But the site is still reading the Twig file from the core theme directory. This is the path of the login page that the Twig debugging shows in the browser:

app/web/themes/contrib/generaluikit/templates/layout/page.html.twig

I have of course refreshed the Drupal cache and browser cache many times, but the new file in the sites folder does not override the file in the themes folder.  I have checked the file/folder permissions and tried it with several different default themes.

This is a problem only for about half of the sites on our Drupal installation. The other sites work just as expected, even ones that use the same theme as ones that do not work. There is no pattern I can make out between why the new login pages work on one site, but not on another.

The sites are already using plenty of Twig files that override the core theme files, so it is especially confusing why the user pages are not working.

This is true for login, register, password user pages as well as the maintenance page.

Alfred Armstrong avatar
cn flag
You say you have twig debugging on. Can you see the template name "page--user--login.html.twig" list as a suggestion in the debugging comments in the page source?
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.