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

Skip sitemap generation when there is no valid base URL #1660

Merged
merged 3 commits into from
Apr 13, 2024

Conversation

caendesilva
Copy link
Member

@caendesilva caendesilva commented Apr 13, 2024

Before, this would fall back to a relative URL, but these no longer validate by Google and will not be indexed. It feels a bit dramatic to have an exception be thrown when building test sites locally so instead we just skip the build, but with a helpful message.

image

Technically this can be seen as a breaking change, as this results in a sitemap file not being generated. But the end result in both cases is the same. Before this change we in this scenario when missing a base URL we get a sitemap that cannot be indexed, and after this change we don't generate a sitemap at all. In both cases, Google will not index the site using the sitemap. In the new case, we at least provide a notice to the user. I think this better follows the principle of least astonishment and thus I believe this justifies targeting HydePHP v1.6 instead of v2.0.

The reason we consider localhost to be a non-valid URL is a tradeoff between users wanting to see what the sitemap looks locally, and when building for production in a CI where they forgot to configure an environment variable. I think the latter weights more heavily here. We could also add a --force flag to the build:sitemap command, but I don't think the complexity is warranted.

Before, this would fall back to a relative URL, but these no longer validate by Google and will not be indexed. It feels a bit dramatic to have an exception be thrown when building test sites locally so instead we just skip the build, but with a helpful message.
@caendesilva caendesilva force-pushed the skip-sitemap-generations-when-setup-is-invalid branch from 4bd9f8f to 7c6393b Compare April 13, 2024 17:39
@caendesilva caendesilva marked this pull request as ready for review April 13, 2024 17:47
@caendesilva
Copy link
Member Author

ChatGPT code review

Since the current behavior results in an invalid sitemap that Google won't index anyway, skipping sitemap generation when there's no valid base URL seems like a sensible change. It doesn't break any existing functionality since the previous behavior also didn't achieve the desired outcome. However, it's important to communicate this change clearly to users who might rely on the previous behavior. You could mention it in release notes or update documentation to ensure users understand why sitemap generation might be skipped in certain cases. This way, they can adjust their workflows accordingly.

@caendesilva caendesilva merged commit 7fcf563 into master Apr 13, 2024
20 checks passed
@caendesilva caendesilva deleted the skip-sitemap-generations-when-setup-is-invalid branch April 13, 2024 18:07
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.

1 participant