Template loading issues in sub theme

Created on 15 November 2023, 8 months ago
Updated 9 March 2024, 4 months ago

Summary

I have copied the module's template files into mytheme's templates folder, the templates are loading when I have checked/implemented in local machine installation when I move the same files into azure server the templates are not loading and its showing the default default template instead of modified, I am using Drupal 9.4.6 version

I have same PHP version, Drupal and other software same versions

The template files I have copied from poll-meter.html.twig, poll-results.html.twig

Steps to reproduce

I have copied above templates from poll/templates to mytheme/templates, the implementation is working in local wampp server but not working in azure server

Proposed resolution

I have tried enabling the twig debug true and other debug methods but not find any solutions
not even logging any error with the particular page

πŸ’¬ Support request
Status

Closed: cannot reproduce

Version

1.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @krishna1406
  • πŸ‡§πŸ‡ͺBelgium BramDriesen Belgium πŸ‡§πŸ‡ͺ

    Made the issue more readable

  • πŸ‡§πŸ‡ͺBelgium BramDriesen Belgium πŸ‡§πŸ‡ͺ

    For new/custom templates to load you need to do a cache rebuild, did you do that?

  • Yes, I have rebuild cache, theme registry , flushed all the cache as well.

  • Status changed to Postponed: needs info 7 months ago
  • πŸ‡§πŸ‡ͺBelgium BramDriesen Belgium πŸ‡§πŸ‡ͺ

    I really need some more info to assist you.

    Please share your folder structure of your theme where you put the template.

    Also doesn't sound like you're using git? Because there would really be no reason for it to work locally but not on your server.

  • Hi Bram,

    Here is my structure of theme \themes\custom\mythemegroup\templates

    inside templates poll-meter.html, poll-results.html we have these 2 templates copied from \modules\contrib\poll\templates folder

    Unfortunately we are not using GIT to move codes. We have only developed above templates to achieve desired outcome only issues the templates are not able to idnetify by drupal in server as its working in local server.

    Also we have tried to enable twig debug and we can see some template suggestions but not sure what would be stopping the templates loading.

  • πŸ‡§πŸ‡ͺBelgium BramDriesen Belgium πŸ‡§πŸ‡ͺ

    Okay, so looks like the template being loaded currently is the one from the Bario Bootstrap theme.

    Q; Is your theme properly declared as a subtheme of Bario Bootstrap?
    Q: Your custom theme is enabled and set as default?

    I checked one of my own projects where we themed the poll, here is the structure: docroot/themes/custom/THEMENAME/templates/poll/poll-meter.html.twig

    Only difference I see here is the subfolder "poll", but that normally should have no effect as far as I know.

    Twig debug normally has no effect on the templates being detected. This is only solved by a complete cache rebuild, just to rule out any other form of caching. After the Drupal cache rebuild, have you tried incognito? And to rule out things like varnish, add something to the url like ?nocache so it's treated as a new URL.

  • Hi Bram,

    Q; Is your theme properly declared as a subtheme of Bario Bootstrap?
    A: Yes, it it propely defined even we have multiple sub themes they are applying for each site as different presentation. Since we are using domain access module.
    Q: Your custom theme is enabled and set as default?
    A: Yes, My custom theme enabled and set as default.

    I checked one of my own projects where we themed the poll, here is the structure: docroot/themes/custom/THEMENAME/templates/poll/poll-meter.html.twig

    The above method also I have tried to created poll folder inside template but still not luck.

    Even the custom content template also not loading - we have created content type "project" and template we have defined as "node--project.html.twig" even this template not loading the same is working in local environment.

  • πŸ‡§πŸ‡ͺBelgium BramDriesen Belgium πŸ‡§πŸ‡ͺ

    Even the custom content template also not loading - we have created content type "project" and template we have defined as "node--project.html.twig" even this template not loading the same is working in local environment.

    That would make me believe there is something else wrong on your server. Maybe a theme not enabled or something. But since it's not only the template of this module, this is a more general issue on your site.

    Unfortunately we are not using GIT to move codes.

    I would highly recommend spending time on that! Managing a project that is live without proper CI/CD or versioning is a nightmare.

  • Status changed to Closed: cannot reproduce 4 months ago
  • πŸ‡§πŸ‡ͺBelgium BramDriesen Belgium πŸ‡§πŸ‡ͺ

    Going to close this for now. Feel free to re-open the issue if you are still encountering this.

Production build 0.69.0 2024