aerni / statamic-advanced-seo

Comprehensive SEO addon for Statamic with flexibility in mind
https://statamic.com/addons/aerni/advanced-seo
10 stars 5 forks source link

Call to a member function taxonomy() on null when running `php please ssg:generate` #142

Closed JayGeorge closed 1 month ago

JayGeorge commented 1 month ago

Hi Michael,

I'm running into the following error when running php please ssg:generate

   Error 

  Call to a member function taxonomy() on null

at vendor/aerni/advanced-seo/src/View/ViewCascade.php:205
    201▕         // Handles collection taxonomy show page.
    202▕         if ($this->model->has('segment_3') && $this->model->value('is_term') === true) {
    203▕             $localizedTerm = $this->model->get('title')->augmentable();
    204▕ 
  ➜ 205▕             return $localizedTerm->taxonomy()->sites()
    206▕                 ->map(fn ($locale) => [
    207▕                     'url' => $localizedTerm->in($locale)->absoluteUrl(),
    208▕                     'locale' => Helpers::parseLocale(Site::get($locale)->locale()),
    209▕                 ])->all();

      +6 vendor frames 

  7   [internal]:0
      Statamic\Data\AugmentedCollection::Statamic\Data\{closure}(Object(Statamic\Fields\Value), "hreflang")
      +35 vendor frames 

  43  please:35
      Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

Here are my support details in case that helps:

Environment
Laravel Version: 10.48.10
PHP Version: 8.2.16
Composer Version: 2.7.6
Environment: local
Debug Mode: ENABLED
Maintenance Mode: OFF

Cache
Config: CACHED
Events: NOT CACHED
Routes: CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: statamic
Database: mysql
Logs: stack / single
Mail: smtp
Queue: sync
Session: file

Livewire
Livewire: v3.4.12

Sentry
Enabled: MISSING DSN
Environment: local
Laravel SDK Version: 3.8.2
PHP SDK Version: 3.22.1
Release: NOT SET
Sample Rate Errors: 100%
Sample Rate Performance Monitoring: NOT SET
Sample Rate Profiling: NOT SET
Send Default PII: DISABLED

Statamic
Addons: 7
Sites: 2 (Something, Something Elese)
Stache Watcher: Enabled
Static Caching: Disabled
Version: 5.3.0 PRO

Statamic Addons
aerni/advanced-seo: 2.5.0
jonassiewertsen/statamic-live-search: 2.1.1
jonassiewertsen/statamic-livewire: 3.3.1
rias/statamic-redirect: 3.7.1
statamic/collaboration: 1.0.0
statamic/ssg: 3.0.1
stefangalescu/statamic-heroicons: 3.0
aerni commented 1 month ago

Can you whip up a quick repo that reproduces this?

JayGeorge commented 1 month ago

Hi Michael, I've just sent you an invite to the repo—probably easier. Let me know how you get on when you run php please ssg:generate

aerni commented 1 month ago

Thanks! I'll take a look.