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.