WithCandour / statamic-aardvark-seo

Candour's SEO addon for Statamic
https://statamic.com/marketplace/addons/aardvark-seo
11 stars 18 forks source link

Call to undefined method Statamic\Entries\Collection::value() in PageDataParser.php#L79 #134

Closed michaelr0 closed 2 years ago

michaelr0 commented 2 years ago

Hi There,

We appear to be having an issue with errors of Call to undefined method Statamic\Entries\Collection::value() on https://github.com/WithCandour/statamic-aardvark-seo/blob/master/src/Parsers/PageDataParser.php#L79

Our header contains this:

@antlers('@{{ aardvark-seo:head }}', collect(get_defined_vars())->except('__data', '__path')->toArray())

And the footer contains:

@antlers('@{{ aardvark-seo:footer }}', collect(get_defined_vars())->except('__data', '__path')->toArray())

We are using Blade as the templating engine and are using the @antlers directive from https://github.com/edalzell/statamic-blade

It seems that the code at https://github.com/WithCandour/statamic-aardvark-seo/blob/master/src/Parsers/PageDataParser.php#L79 fails to fall back properly, it seems like the switch statement will only ever trigger the taxonomies or collections cases and never the default $repo = null possibility, due to https://github.com/WithCandour/statamic-aardvark-seo/blob/master/src/Parsers/PageDataParser.php#L72

The home.md is as follows.

---
id: home
blueprint: pages
title: Home
template: default
author: 5bef2ef8-3cae-48fe-9282-1402d589dc8e
protected: false
show_page_title: true
updated_by: a0f225b9-3121-46d9-b772-b2adb1fa220a
updated_at: 1653540068
show_excerpt_in_header: true
enable_header_content_right: false
meta_title: 'Title'
meta_description: 'Description'
use_meta_keywords: false
no_index_page: false
no_follow_links: false
sitemap_priority: '0.5'
sitemap_changefreq: daily
override_twitter_settings: false
override_twitter_card_settings: false
twitter_card_type_page: summary
---
Welcome to your new Statamic website.

To add to this, it appears if I change the view to be an antlers file, with only

{{ aardvark-seo:head }}

{{ aardvark-seo:footer }}

Then I get the following error: Call to a member function value() on string from https://github.com/WithCandour/statamic-aardvark-seo/blob/master/src/Tags/AardvarkSeoTags.php#L69

php please support:details

Statamic 3.2.39 Pro
Laravel 8.83.14
PHP 8.1.6
edalzell/blade-directives 3.7
handmadeweb/buildamic dev-main
handmadeweb/frosty 1.1.6
handmadeweb/statamic-cloudflare 1.0.6
handmadeweb/statamic-laravel-packages 1.0.3
mattrothenberg/statamic-mapbox-address 0.7.2
withcandour/aardvark-seo 2.0.25

Stacktrace:

image image
michaelr0 commented 2 years ago

@AndrewHaine has advised me to downgrade to 2.0.24 to resolve the issue, while a fix is being implemented, I can confirm that if anyone else find themselves having this issue with 2.0.25, then the solution is to downgrade to 2.0.24 or upgrade to 2.0.26 or whatever version has resolved the issue (should you be reading this in the future)

AndrewHaine commented 2 years ago

Hi @michaelr0 ,

This has now been resolved in version 2.0.26.

Thanks, Andrew

michaelr0 commented 2 years ago

Thanks @AndrewHaine