diff --git a/system/src/Grav/Common/Twig/Twig.php b/system/src/Grav/Common/Twig/Twig.php index e1ba281f4a..a47a2b7aa8 100644 --- a/system/src/Grav/Common/Twig/Twig.php +++ b/system/src/Grav/Common/Twig/Twig.php @@ -238,7 +238,9 @@ public function processPage(Page $item, $content = null) // Process Modular Twig if ($item->modularTwig()) { $twig_vars['content'] = $content; - $template = $item->template() . TEMPLATE_EXT; + $extension = $this->grav['uri']->extension(); + $extension = $extension ? ".{$extension}.twig" : TEMPLATE_EXT; + $template = $item->template() . $extension; $output = $content = $local_twig->render($template, $twig_vars); }