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

Adds the date to the meta description length when the description is empty #21367

Merged
merged 1 commit into from
May 7, 2024

Conversation

mhkuu
Copy link
Contributor

@mhkuu mhkuu commented May 6, 2024

Context

  • When adding the fixed variables in Meta description mentions block/classic/elementor-editor #21184, it became clear that we were not showing anything in the length progress bar when no description was entered by the user. This PR fixes that, by always counting the date + separator (14 characters, leading to an orange progress bar, or red for cornerstone content), even when no description has been provided. Of course, for products or taxonomies, the date is not shown, and thus the length indicator will still not show.

Summary

This PR can be summarized in the following changelog entry:

  • Fixes a bug where the character count of the meta description field would not include the automatically added date and separator when no additional content was provided.
  • [yoastseo] Fixes a bug where the character count of the meta description field would not include the automatically added date and separator when no additional content was provided.

Relevant technical choices:

  • The length calculation of the meta description now always includes the date, even if the user-provided content is empty.

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

  • Set your site language to English.
  • Create a new post.
  • Check the meta description field in the Search Appearance settings.
  • Confirm that an orange bar is displayed below the field (and the date and separator badges are present).
  • When you inspect the element, confirm that the <progress> element has the attribute value=14 (note that this value depends on the date of the post. It can also be 15 for a post later in the month, or some other value if you have a different language activated. At least the value will not be 0 as it were before 😄).
  • Confirm that for products or taxonomies, no bar is displayed (and the date and separator badges are not present).

Relevant test scenarios

  • Changes should be tested with the browser console open
  • Changes should be tested on different posts/pages/taxonomies/custom post types/custom taxonomies
  • Changes should be tested on different editors (Default Block/Gutenberg/Classic/Elementor/other)
  • Changes should be tested on different browsers
  • Changes should be tested on multisite

Test instructions for QA when the code is in the RC

  • QA should use the same steps as above.

QA can test this PR by following these steps:

Impact check

This PR affects the following parts of the plugin, which may require extra testing:

  • The length calculation of the meta description.

UI changes

  • This PR changes the UI in the plugin. I have added the 'UI change' label to this PR.

Other environments

  • This PR also affects Shopify. I have added a changelog entry starting with [shopify-seo], added test instructions for Shopify and attached the Shopify label to this PR.

Documentation

  • I have written documentation for this change. For example, comments in the Relevant technical choices, comments in the code, documentation on Confluence / shared Google Drive / Yoast developer portal, or other.

Quality assurance

  • I have tested this code to the best of my abilities.
  • During testing, I had activated all plugins that Yoast SEO provides integrations for.
  • I have added unit tests to verify the code works as intended.
  • If any part of the code is behind a feature flag, my test instructions also cover cases where the feature flag is switched off.
  • I have written this PR in accordance with my team's definition of done.
  • I have checked that the base branch is correctly set.

Innovation

  • No innovation project is applicable for this PR.
  • This PR falls under an innovation project. I have attached the innovation label.
  • I have added my hours to the WBSO document.

Fixes https://github.com/Yoast/plugins-automated-testing/issues/1529

@mhkuu mhkuu added the changelog: bugfix Needs to be included in the 'Bugfixes' category in the changelog label May 6, 2024
@mhkuu mhkuu added this to the 22.7 milestone May 6, 2024
@coveralls
Copy link

Pull Request Test Coverage Report for Build f666e8f3f2a098eb8676bd2f66ca2e73dfe1f442

Details

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • 1434 unchanged lines in 40 files lost coverage.
  • Overall coverage decreased (-1.2%) to 51.243%

Files with Coverage Reduction New Missed Lines %
admin/class-option-tabs-formatter.php 1 0.0%
src/actions/configuration/first-time-configuration-action.php 1 91.84%
src/generated/assets/externals.php 1 0.0%
src/generated/assets/languages.php 1 0.0%
src/generators/breadcrumbs-generator.php 1 64.23%
src/integrations/blocks/structured-data-blocks.php 1 16.0%
src/integrations/settings-integration.php 1 28.49%
admin/class-admin-editor-specific-replace-vars.php 2 85.71%
admin/endpoints/class-endpoint-statistics.php 2 0.0%
admin/formatter/class-metabox-formatter.php 2 91.77%
Totals Coverage Status
Change from base Build aa17961d17087001e6601a3491e00b3e988b2bfc: -1.2%
Covered Lines: 28351
Relevant Lines: 56270

💛 - Coveralls

@mhkuu
Copy link
Contributor Author

mhkuu commented May 6, 2024

You can safely ignore the coveralls build not passing, as you can see this PR actually adds a test case.

@mykola mykola merged commit 31a6c64 into release/22.7 May 7, 2024
15 of 16 checks passed
@mykola mykola deleted the fix/meta-description-length branch May 7, 2024 09:38
mhkuu added a commit that referenced this pull request May 16, 2024
…gth"

This reverts commit 31a6c64, reversing
changes made to 2ff480e.
@mhkuu mhkuu mentioned this pull request May 16, 2024
18 tasks
@mhkuu mhkuu added changelog: reverted Needs to be excluded from all categories in the changelog, should be used for reverted PR and removed changelog: bugfix Needs to be included in the 'Bugfixes' category in the changelog labels May 17, 2024
@hardikgohil7988
Copy link

#21385 due to this revert, the current PR is the same as the 22.6 version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: reverted Needs to be excluded from all categories in the changelog, should be used for reverted PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants