Kirby-Twig on Kirby 4

I’m using the plain kit with Kirby 4. Download and unzipped the Twig-Kirby plugin onto site/plugins/kirby-twig so I can use my Twig templates, but immediately get the error message:

The section “pages” could not be loaded: Class “Wearejust\Kirby\Twig\Template” not found

It’s the first time I see this but it’s also my second Kirby website and found no other threads on this…

I see that on index.php this snippet mentions the path that’s in the error message:

 'components' => [
        'template' => function (App $kirby, string $name, string $contentType = 'html', string $defaultType = 'html') {
            return new Wearejust\Kirby\Twig\Template($name, $contentType, $defaultType);

Nothing on the kirby-twig readme file mentions other step and not sure what I can do here…

Is the plugin still compatible with kirby 4?

Did you do a composer install in the project folder to load the dependencies? When you just download the files, the vendor folder is missing. Documentation seems a bit incomplete.

Thank you for the reply! I tried to do a composer install on the general project folder, no changes. Then I did it again but on the kirby-twig folder, and that did it. I’m not sure if this is correct and/or best practice, but it seems to work now.

That’s what I meant, yes.

1 Like