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

Meta description mentions block/classic/elementor-editor #21184

Merged

Conversation

Jordi-PV
Copy link
Contributor

@Jordi-PV Jordi-PV commented Feb 28, 2024

Context

  • In the Search Appearance tab, the meta description length assessment includes the date and separator characters in the analysis, although this might not be immediately clear to users. To enhance the user experience and provide the right information, we've introduced fixed date and separator variables within the editor. Now, when users hover over these variables, a tooltip displays the information with the exact number of characters counted. This will offer users clarity on what is included in the character count and help them craft meta descriptions more effectively.
  • We only add the date and separator in posts and pages, so these are the only content types where this is relevant.

Summary

This PR can be summarized in the following changelog entry:

  • Introduces a date and a separator snippet variable to the meta description text field, to make clear that both the date and a separator are automatically added to the character count of the meta description. Hovering over the variables reveals a tooltip with more explanation.
  • [@yoast/replacement-variable-editor 0.1.0] Adds mentions to the ReplacementVariableEditor for clearer user interpretation.

Relevant technical choices:

  • Named the date and separator variables as mentions in the code, matching our naming in the ReplacementVariableEditorStandalone.js and the SnippetEditor.
  • Placed the file in the shared-admin directory, making it accessible from different environments.
  • Added a css additional-mentions.css file to adjust the alignment of the elements in the Meta description text editor.
  • The name additionalMentions is a continuation of the additionalButtons in the ReplacementVariableEditor component.

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

  • Activate Yoast SEO free plugin.
  • Open/create a post or page.
  • Go to the SEO/Search appearance tab of the Yoast SEO plugin, and check that the Meta description text editor includes the Date and Separator badges.

image

  • Make sure that this variable badges are fixed and can not be removed.
  • Check that on hover with the mouse pointer over the badges, a tooltip is shown providing the information over the number of characters counted for the Meta description length analysis.

image

  • Change the language of your WordPress back-end interface.
  • If translated, the Date and Separator badges will be in the selected language. The tooltip information text will still show in English, until it is released and translated.

image

  • Check that the fixed badges in the Meta description text editor, are displayed in the block, classic and Elementor editor.
    image

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:

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 #

@coveralls
Copy link

coveralls commented Feb 28, 2024

Pull Request Test Coverage Report for Build 41a2a2603968e234b1eef8a7fa9288446598633a

Details

  • 1 of 24 (4.17%) changed or added relevant lines in 5 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.02%) to 52.245%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/js/src/elementor.js 0 1 0.0%
packages/js/src/post-edit.js 0 1 0.0%
packages/replacement-variable-editor/src/ReplacementVariableEditor.js 0 2 0.0%
packages/js/src/shared-admin/helpers/search-appearance-description-mention.js 0 19 0.0%
Totals Coverage Status
Change from base Build 13e6a93bb320ed9aa3323a24c74219c83e6525d1: -0.02%
Covered Lines: 28618
Relevant Lines: 55328

💛 - Coveralls

…description-length-includes-date-but-thats-not-very-clear
…description-length-includes-date-but-thats-not-very-clear
…seo into 974-meta-description-length-includes-date-but-thats-not-very-clear
…description-length-includes-date-but-thats-not-very-clear
…seo into 974-meta-description-length-includes-date-but-thats-not-very-clear
…description-length-includes-date-but-thats-not-very-clear
…description-length-includes-date-but-thats-not-very-clear
…description-length-includes-date-but-thats-not-very-clear
@Jordi-PV Jordi-PV changed the title Meta description length includes date Meta description mentions editor Apr 5, 2024
@Jordi-PV Jordi-PV changed the title Meta description mentions editor Meta description mentions block-editor Apr 5, 2024
@Jordi-PV Jordi-PV changed the title Meta description mentions block-editor Meta description mentions block/classic/elementor-editor Apr 11, 2024
@Jordi-PV Jordi-PV added the UI change PRs that result in a change in the UI label Apr 12, 2024
@Jordi-PV Jordi-PV added changelog: enhancement Needs to be included in the 'Enhancements' category in the changelog compatibility: Elementor labels Apr 12, 2024
…description-length-includes-date-but-thats-not-very-clear
@Jordi-PV Jordi-PV marked this pull request as ready for review April 12, 2024 13:58
…-length-includes-date-but-thats-not-very-clear
*/
const filterReplacementVariableEditorMentions = ( mentions, { fieldId } ) => {
const isRtl = get( window, "wpseoScriptData.metabox.isRtl", false );
const dateCharacters = date().length;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you can use the following code to get date and avoid global variable.
const getDate = select( "yoast-seo/editor" ).getDateFromSettings;
const dateCharacters = getDate().length;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call! 💯

@mykola mykola merged commit 3ddc9c9 into trunk Apr 23, 2024
35 checks passed
@mykola mykola deleted the 974-meta-description-length-includes-date-but-thats-not-very-clear branch April 23, 2024 09:03
@igorschoester igorschoester added this to the 22.7 milestone Apr 24, 2024
mhkuu added a commit that referenced this pull request May 16, 2024
…gth-includes-date-but-thats-not-very-clear"

This reverts commit 3ddc9c9, reversing
changes made to 651d403.
@mhkuu mhkuu added changelog: reverted Needs to be excluded from all categories in the changelog, should be used for reverted PR and removed changelog: enhancement Needs to be included in the 'Enhancements' category in the changelog labels May 17, 2024
@hardikgohil7988
Copy link

Changes are reverted in this PR #21385

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 UI change PRs that result in a change in the UI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants