WithCandour / statamic-aardvark-seo

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

Statamic SSG - Call to a member function url() on null #167

Closed bradfloodx closed 4 months ago

bradfloodx commented 10 months ago

Running php please ssg:generate --verbose with withcandour/aardvark-seo@3.0.0 and statamic/cms@4.45.0 and statamic/ssg@2.2.0 gives me:

Gathering content to be generated...

   Error

  Call to a member function url() on null

  at vendor/statamic/ssg/src/Request.php:51
     47▕     }
     48▕
     49▕     public function getPathInfo(): string
     50▕     {
  ➜  51▕         return $this->page->url();
     52▕     }
     53▕
     54▕     public function path()
     55▕     {

  1   vendor/symfony/http-foundation/Request.php:1022
      Statamic\StaticSite\Request::getPathInfo()

  2   vendor/laravel/framework/src/Illuminate/Http/Request.php:108
      Symfony\Component\HttpFoundation\Request::getUri()

  3   vendor/withcandour/aardvark-seo/src/Listeners/AppendEntrySeoFieldsListener.php:20
      Illuminate\Http\Request::url()

  4   vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php:441
      WithCandour\AardvarkSeo\Listeners\AppendEntrySeoFieldsListener::handle(Object(Statamic\Events\EntryBlueprintFound))

Perhaps this is related to https://github.com/statamic/ssg/issues/134 ?

Is anyone at Candour using SSG with Statamic V4?

bradfloodx commented 10 months ago

In statamic v3 I could get around this error sometimes by doing please stache:warm but not anymore with v4.

bradfloodx commented 10 months ago

I'm not sure how to help further. I'm not great with PHP. Anything else I can do to help?

bradfloodx commented 9 months ago

@AndrewHaine any thoughts? Thanks bro!

bradfloodx commented 9 months ago

By the way if I composer remove withcandour/aardvark-seo the SSG site builds fine. It only fails with the above error when withcandour/aardvark-seo is added.

CandourDevs commented 4 months ago

@brad-sf Hi. Sorry about your difficulties. We were able to run php please ssg:generate on the latest versions of Statamic and Aardvark without a problem. We recommend updating your versions, if you are able, and giving it another try.

bradfloodx commented 4 months ago

Works on latest :)