-
Notifications
You must be signed in to change notification settings - Fork 101
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
Use plugin slug for generator tag #1103
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
+1 to making this change, makes sense for the long run. One issue worth noting that will arise from this change will be that any queries against a feature will need to take both old and new slugs into account to work properly. |
@@ -54,6 +54,7 @@ function plsr_print_speculation_rules() { | |||
* @since 1.1.0 | |||
*/ | |||
function plsr_render_generator_meta_tag() { | |||
echo '<meta name="generator" content="Speculative Loading ' . esc_attr( SPECULATION_RULES_VERSION ) . '">' . "\n"; | |||
// Use the plugin slug as it is immutable. | |||
echo '<meta name="generator" content="speculation-rules ' . esc_attr( SPECULATION_RULES_VERSION ) . '">' . "\n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably want to bump the plugin version as well, otherwise users won't get this update.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adamsilverstein That version is already bumped (and not published), so this PR doesn't need to bump it again. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we take this opportunity to add generator tags to the auto-sizes plugin as well? We should also make sure that all plugins have tests in place to cover this behavior.
Slugs never change, so that's the main reason for why this change is proposed. Only now this one time we would have to update tooling, to switch from the plugin names to plugin slugs.
I was going to do that in a separate PR.
+1, let me check that every plugin is covered by such a test. |
@joemcgill Tests for all generator tags and that they include the slugs are now present. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @felixarntz. One follow-up question, but this is looking good.
@@ -19,6 +19,11 @@ public function tear_down() { | |||
parent::tear_down(); | |||
} | |||
|
|||
public function test_hooks() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. I don't think we are validating that hooks are always present for each of the plugins. Should this type of test be added everywhere, since I don't believe we can run tests against the output of wp_head
to confirm that these are actually being printed without introducing side effects?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joemcgill I generally like to have this kind of test as it helps prevent accidents with hooks added or removed, but I wouldn't want to mandate it. IMO it's a good practice, but I still think this is something we can leave up to the typical freedom of choice of the respective plugin developers / PR authors and PR reviewers.
I only added this here since the hook check previously was baked into the generator test method, which IMO it shouldn't be since it's a different kind of test.
Summary
Based on the discussion in #1102 (comment): Since plugin names can change over time, the original approach of using the plugin names for generator tags is not great. Therefore this PR proposes using the plugin slug, which is immutable. In the long run, this will be more maintainable as it won't result in tooling or queries requiring an update.
Relevant technical choices