HashandSalt / kirby3-seo

A plugin for generating SEO meta tags
10 stars 2 forks source link

Internal Server Error #5

Closed benoitbohnke closed 11 months ago

benoitbohnke commented 11 months ago

I've got Internal Server Error when using the controller. Is it compatible with kirby 3.9 ?

HashandSalt commented 11 months ago

Could you please give more information? Works just fine for me with kirby 3.9.7.

benoitbohnke commented 11 months ago

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..

HashandSalt commented 11 months ago

Could you post what you have in your controller?

benoitbohnke commented 11 months ago

Yep

`<?php

return function ($page, $kirby, $site) {

// SEO $seo = $kirby->controller('seo' , compact('page', 'site', 'kirby'));

return $seo;

};`

HashandSalt commented 11 months ago

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.

benoitbohnke commented 11 months ago

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.

benoitbohnke commented 11 months ago

Ok I've had a seo.php controller before. I've deleted that and it's working fine. Thanks a lot !!

HashandSalt commented 11 months ago

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

benoitbohnke commented 11 months ago

So I shouldn't add a controller per template ? Is there a way to do that globally ?

HashandSalt commented 11 months ago

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.

benoitbohnke commented 11 months ago

Yes, that makes sense, thanks ;)