Plugin conflict with SEOmatic
daniellefrapp opened this issue · comments
There seems to be a plugin conflict with Fallback site and SEOmatic, when I have fallback site turned on and I try to go to one of my sitemaps or robots.txt generated by SEOmatic I get a 404. All works as expected when I disable Fallback site.
The issue has two parts:
Fallback Site ran its initialization immediately when loaded. This uses Craft's UrlManager, and caused any plugin loaded afterwards to not be able to receive events from the UrlManager
, such as EVENT_REGISTER_CP_URL_RULES
, and EVENT_REGISTER_SITE_URL_RULES
. Instead, will now run its initialization on the EVENT_AFTER_LOAD_PLUGINS
event, ensuring other plugins have the chance to add their event handlers before initializing. This change has been made in 92fe44f
SEOmatic waits until the EVENT_AFTER_LOAD_PLUGINS
event to add event handlers to the UrlManager
, but this will always happen after Fallback Site, because they are loaded, and their events fire, in alphabetical order. Instead, attaching event handlers to the UrlManager
would need to be moved to the plugin's own init()
method as well, instead of happening as late as it does.
I'd discussed the issue with @khalwat when this issue was opened. It's been a while, but right now the ball is in SEOmatic's court to update the event timing. While Fallback Site could be forced to trigger even later, that would simply be glossing over the underlying problem.