aerni / statamic-advanced-seo

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

Error after converting to multisite #56

Closed Narretz closed 1 year ago

Narretz commented 1 year ago

Hi, it's me again with another bug report ;)

I have a simple statamic site with a simple collection and advanced-seo enabled. After converting the site with php please multisite, I get the following error when trying to access a collection entry:

https://flareapp.io/share/omwrgWR5#F109

aerni commented 1 year ago

You have to restructure your seo content files for multi-site as well. That's probably what's causing your issue. I suggest you create a fresh install, enable multi-site, install Advanced SEO and save some SEO site defaults in the CP. Then look at the content structure and restructure the content of your site accordingly.

aerni commented 1 year ago

Did you get this resolved?

Narretz commented 1 year ago

Hi @aerni I kind of got it resolved so that it works, but I'm haven't narrowed the source down 100%, because the multisite command does move advanced-seo files (as they are just content). So far it looks like the following is happening:

If you don't have a seo/site/general.yaml before converting to multisite, then advanced-seo throws this error after converting.

I want to investigate this further, but I won't have time before next week.

Narretz commented 1 year ago

I have reproduced the error this way:

-> but when opening a page, you get the above error

It's an edge case, but it's surprising nevertheless

There's also another related issue: after converting to multisite, statamic complains about duplicate ids:

/statamic-fresh/content/seo/site/social_media.yaml  
/statamic-fresh/content/seo/site/default/social_media.yaml  
/statamic-fresh/content/seo/site/en/social_media.yaml 
aerni commented 1 year ago

I can't quite reproduce a few of the things you're mentioning.

… content/seo/analytics.yaml is created …

This file is not created for me. It's only created when I visit the Analytics defaults in the CP.

… the existing content seo files are moved into the respective subfolders

This only happens for the collections folder (it might also happen for taxonomies). The files of the site folder are not converted to multisite. It looks like Statamic is simply looking for folders by name and is converting the collections and taxonomies of Advanced SEO alongside its own collections and taxonomies folders. And the site folder is not converted because Statamic doesn't have a site folder.

There's also another related issue: after converting to multisite, statamic complains about duplicate ids:

I also can't reproduce this.

Generally, I didn't come across the exception you mentioned in your first post. I'm closing this issue, as it is not really an issue with Advanced SEO but the multisite command of Statamic. There's not much I can do to fix this issue.

Narretz commented 1 year ago

Thanks for testing!

This file is not created for me. It's only created when I visit the Analytics defaults in the CP.

Then I must have opened the page

For the other things - maybe it's a difference between Statamic 3 and 4. I tested on 3.

aerni commented 1 year ago

I also tested on v3 😅