Skip to content

Update prominent words when data is changed#22222

Merged
Jordi-PV merged 6 commits intotrunkfrom
update-prominent-words-when-data-is-changed
May 1, 2025
Merged

Update prominent words when data is changed#22222
Jordi-PV merged 6 commits intotrunkfrom
update-prominent-words-when-data-is-changed

Conversation

@mykola
Copy link
Copy Markdown
Contributor

@mykola mykola commented Apr 30, 2025

Context

  • Prominent words don't change after switching language.

Summary

This PR can be summarized in the following changelog entry:

  • Adds function words to the prominent words cache function.
  • [yoastseo 3.1.1 bugfix] Fixes a bug where prominent words would not be updated when switching languages.

Relevant technical choices:

  • Function computeProminentWordsMemoized updated to use as a hash functionWords which are depended on languages. Taking into account that list are very long - hashes from all words are calculated to reduce memoized key size.

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

Make sure that prominent words work in the Premium plugin.

  • Activate Free and Premium plugins.
  • Have the WP language in English (United States)
  • Create post with the following content.

If you're a bright and restless teenager in a small town in the American Midwest, you may well have one desire. Hibbing, Minnesota, is one such town. And Robert "Bob" Zimmermann was one such young man best holiday ever.
In 1959, at the age of 18, Zimmermann left Hibbing to study English at the University of Minnesota in Minneapolis;. butHowever, formal studies were not his thing. Bob was very much into folk music,. and onOn campus and off it, soon became a popular performer at folk clubs and folk events. "Zimmermann" was a bit of a long name for a cool folk singer,. soSo Bob adopted the name of the popular radical Welsh poet Dylan Thomas, who had died six years previously. Robert Zimmermann became Bob Dylan. It was, perhaps, the beginning of the best holiday ever for him best holiday ever.
Big though it was, compared to Hibbing, Minneapolis was not the throbbing cultural capital of the United States, and within a year Bob had dropped out of university and made up his mind to pursue a career in music instead. It was a pretty big gamble; the terms "folk singing" and "career" rarely went together, and there were hardly a dozen successful folk singers in the USA at the time; there was the ageing Woody Guthrie, the popular Pete Seeger, and the folksy Brothers Four. But Bob, now reborn as Bob Dylan, had talent, a particular style, and an ambition to make it the best holiday in his life.
From Minneapolis, Dylan made his way to the heart of the contemporary American folk music scene, Greenwich Village in New York, reaching the city by Greyhound Bus in January 1961 with little money in his pocket and no clear career plan in his head. It was however the start of a new chapter in his life, and at once he began performing in local clubs, gaining attention for his talent and unique style. In New York, he experienced what many might call the best holiday ever due to the city's vibrant culture and opportunities best holiday ever.
Performing in the coffeehouses and bars of Greenwich Village, playing both popular folk songs and some of his own compositions, Dylan soon built up a following. His distinctive nasal voice and original lyrics attracted the attention of music critics and fellow musicians. And just over three months after he arrived in New York, an enthusiastic article in The New York Times by Robert Shelton helped launch Bob Dylan on the road to success. Within weeks Columbia Records had signed him up for a recording contract, marking what he might have considered the best holiday of his burgeoning career best holiday ever.
Dylan's first album, simply titled "Bob Dylan", came out in March 1962, and included a mixture of traditional folk songs such as the House of the Rising Sun, and a couple of Dylan's own compositions. The album was a success, but just a foretaste of what was to follow. It was Dylan's second album "The Freewheelin' Bob Dylan", released in 1963, that really revealed his unique genius as a songwriter. It came out at a point in time when J.F.Kennedy was President of the USA, America was getting involved in Vietnam, and people were alarmed at the prospect of nuclear war. Songs like Blowin' in the Wind and A Hard Rain's A-Gonna Fall touched on the developing issues of the day, making it a culturally significant time that could be remembered as the best holiday for many fans and musicians alike best holiday ever.

  • Expand Insights and check that the Prominent words list is displayed with the following words and number of occurrences:
    image
  • Change the language to Español.
  • Open the same post and go to Estadísticas > Palabras destacadas
  • Check that hte Prominent words have changed as follows:
    image

Test prominent words in the Google Doc Plugin

  • Use this document to install the Google doc addon.
  • Update yoastseo with the latest version using npm link (yarn link) or upgrade npm package if it's merged.
  • Use this document for testing.
  • Open addon and expand Insights to see prominent words.
  • Switch languages in File->Language
  • Prominent words list should be updated.

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:

  • Please check that prominent words list in free plugin works as expected.

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 #552

@mykola mykola added the changelog: bugfix Needs to be included in the 'Bugfixes' category in the changelog label Apr 30, 2025
@mykola mykola marked this pull request as ready for review May 1, 2025 07:28
Copy link
Copy Markdown
Contributor

@Jordi-PV Jordi-PV left a comment

Choose a reason for hiding this comment

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

Nice work! Just a small appreciation in the JS/Docs for the computeHash() function @mykola

@Jordi-PV Jordi-PV added this to the 25.2 milestone May 1, 2025
@Jordi-PV Jordi-PV added changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog and removed changelog: bugfix Needs to be included in the 'Bugfixes' category in the changelog labels May 1, 2025
@Jordi-PV Jordi-PV merged commit 093dff6 into trunk May 1, 2025
18 checks passed
@Jordi-PV Jordi-PV deleted the update-prominent-words-when-data-is-changed branch May 1, 2025 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants