Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter out pages without a uri #133

Merged
merged 1 commit into from
Dec 4, 2020
Merged

Conversation

michaellindahl
Copy link
Contributor

SEO Pro currently makes the assumption that all collection entries are public facing on their own URI. However, myself and others [1][2] use collections that do not have routes.

Borrowing from my solution in statamic/ssg this fixes the bugs where entries without routes are shown in the sitemap.xml and in the seo report.

This does not handle hiding the SEO section from Blueprint or the Collection entries themselves. I wasn't able to figure this out. I was able to hide the SEO tab from the collection entries by adding the following to Blueprint.addSeoFields(), but unable to hide the SEO section in the Blueprint view. However, it may be beneficial to keep these in place if these collections ever are upgraded to public facing entries. Wouldn't make sense for the report/sitemap; but could for these fields.

        if ($this->data instanceof Entry && is_null($this->data->uri())) {
            return;
        }

This does make me wonder if there should be a more wholistic approach to routeless collections. Or maybe checking if the entry has a URI is exactly the correct approach.

Before:
image

After:
image

This fixes the bug where items without routes are shown in the sitemap.xml and in the seo report
@jesseleite
Copy link
Member

@michaellindahl just wanted to follow up... Will be circling back to SEO Pro soon-ish, and will check this out. Just didn't want to leave you hanging! Thanks for the PR!

@jesseleite jesseleite merged commit ba75c36 into statamic:master Dec 4, 2020
@jesseleite
Copy link
Member

@michaellindahl Sorry this took so long to merge! Tests pass, lovely thanks 🤘

jesseleite added a commit that referenced this pull request Dec 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants