I have a content type, blog_post
, that is displayed by a number of different views.
I'm having a problem that the node template that gets used first after clearing the cache will then be used for all other views.
For example one page displays a view called "Blog Posts". If I load this page after clearing the cache, it correctly uses the template node--view--blog-posts.html.twig
.
Another page uses the view "Latest Blog Posts", and this should use the template, node--view--latest-blog-posts.html.twig
. However if I load this page without clearing the cache first, it uses the node--view--blog-posts.html.twig
template.
If I clear the cache and reload the second page, it will then use the correct template, but if I go back to the first page, it will be using the template for the second!
I have twig debugging enabled, and it shows the wrong view name under "FILE NAME SUGGESTIONS" as follows:
<!-- FILE NAME SUGGESTIONS:
* node--view--blog-posts--page.html.twig
x node--view--blog-posts.html.twig
* node--20--teaser.html.twig
* node--20.html.twig
* node--blog-post--teaser.html.twig
* node--blog-post.html.twig
* node--teaser.html.twig
* node.html.twig
-->
I expect that lots of other sites theme nodes in multiple views, so I expect I'm done something wrong. Any suggestions how I can debug this?