'HOOK_module_theme_suggestions_node_alter suggestion twig not working
I implemented a HOOK_module_theme_suggestions_node_alter to add a custom twig template. Now below is my code
function gf_theme_module_theme_suggestions_node_alter(array &$suggestions, array $variables) {
$suggestions[] = 'node--products-template--simple';
}
Now it does appear in the inspector but the page does not use the custom twig file I added eventhough the file exist. Any idea?
Below are the screenshot
I already cleared my cache but still no luck. It's still loading the node.html.twig eventhough the node--products-template--simple.html.twig exist. The file exist in the same folder as the node.html.twig file
Solution 1:[1]
Use underscores instead of hyphens in suggestions:
$suggestions[] = 'node__products_template__simple';
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Kien Nguyen |


