paulmassen / grav-plugin-seo

Manage your site’s meta tags for display in search engine results or social media networks. Create and manage json-ld microdata. Includes an easy-to-use live preview feature.
MIT License
84 stars 21 forks source link

Moving a page can cause an error - Call to a member function media() on null #61

Open CSixtyFour opened 6 years ago

CSixtyFour commented 6 years ago

Hi I've found that if I move a page in the admin panel it can then crash the page on viewing with the error "Call to a member function media() on null" in seo.php because one (or more) of the screenshot image links is now incorrect. One quick work around is to store screenshot images in a central "images" folder rather than in the page folder.

CSixtyFour commented 6 years ago

I should have mentioned the issue here: line 79

$imgarray = $this->grav['page']->find($fixedurl)->media()->images();
paulmassen commented 6 years ago

Hi,

Sorry I'm late to answer.

This is not really a bug, as it is the way Grav is designed, a similar problem with the file field exist: Here is a link with rhukster's explanation https://github.com/getgrav/grav-plugin-admin/issues/1446

Hope this helps

CSixtyFour commented 6 years ago

Actually after a bit more use I found it was crashing the page even when the image field was blank. The only solution was the disable twitter and/or facebook and then page was usable again.

I think I tracked the issue down to the find function crashing due to the null variables being passed which I guess is really a core Grav issue not your plugin.