Closed benoitbohnke closed 11 months ago
Could you please give more information? Works just fine for me with kirby 3.9.7.
Thanks for your reply. Well, I followed your instructions (add a tab in my blueprints, put the snippets in the right folder). Everything went right. Then I've add a home.php with the minimal controller into site/controllers and my homepage respond with an internal server error. Other pages still working and removing the controller makes it work again. Don't know what I'm doing wrong..
Could you post what you have in your controller?
Yep
`<?php
return function ($page, $kirby, $site) {
// SEO $seo = $kirby->controller('seo' , compact('page', 'site', 'kirby'));
return $seo;
};`
And that works fine on other pages? I don't understand why you are seeing a internal server rather then a Kirby Whoops error message.
Other pages works yes, but I don't add any controller for their templates. I'm in debug mode. Didn't add anything to my htaccess. I'm working locally.
Ok I've had a seo.php controller before. I've deleted that and it's working fine. Thanks a lot !!
ahh yes they would clash i think if you had another copy in your sites controllers folder. It's a shared controller which is what this line does....
$seo = $kirby->controller('seo' , compact('page', 'site', 'kirby'));
https://getkirby.com/docs/cookbook/templating/shared-controllers
So I shouldn't add a controller per template ? Is there a way to do that globally ?
No you absoloutly can add a controller per template. The concept of shared controllers, like an SEO related one, means you can essentially import a controller into all the other controllers and they get merged. In this way you can still have a controller with custom stuff in it + the common, shared controller from the SEO plugin. They get merged together and returned to the template, if that makes sense.
Yes, that makes sense, thanks ;)
I've got Internal Server Error when using the controller. Is it compatible with kirby 3.9 ?