WithCandour / statamic-aardvark-seo

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

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

Open brad-sf opened 5 months ago

brad-sf commented 5 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?

brad-sf commented 5 months ago

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

brad-sf commented 5 months ago

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

brad-sf commented 4 months ago

@AndrewHaine any thoughts? Thanks bro!

brad-sf commented 4 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.