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

fix: duplicated structured data in product search context #671

Merged
merged 1 commit into from
Oct 2, 2024

Conversation

iago1501
Copy link
Contributor

@iago1501 iago1501 commented Oct 1, 2024

What problem is this solving?

This commit has the intention to fix the duplicated array of itemList in structured data , that occurs on PLP pages. Google rich result is complaining about this duplicated node element causing some crawling issues

We found out that there are two occurrences of ProductListStructuredData in the same PLP.
The SearchWrapper element from vtex-apps/store is responsible for the first. Gallery and vtex.search-result is responsible for the other

What happens is that when in search context we add the structured data, and, in search context, we also use gallery, which is also adding the structured data.

The main purpose is to check if the block is under the context of store.search to check if it's going to add the structured data element or not

This PR simply adds this validation to understand in which context the gallery is being used to avoid duplicated node content

How to test it?

Before

Steps to reproduce:

  • Open the link above
  • Open DevTools
  • Go to Elements tab
  • Search (cmd+f) for the following string: {"@context":"https://schema.org","@type":"ItemList","itemListElement"

Expected Behavior:

  • You should find two occurrences of this string
  • The content of the Structured JSON that starts with the searched string must be the same (duplicates)
    image

After

Steps to reproduce:

  • Open the link above
  • Open DevTools
  • Go to Elements tab
  • Search (cmd+f) for the following string: {"@context":"https://schema.org","@type":"ItemList","itemListElement"

Expected Behavior:

  • You should find only one occurrence of this string.
    • The first occurrence in the HTML, from the SearchWrapper component

image

Describe alternatives you've considered, if any.

We adopted this approach instead of removing it from store.search the gallery component just to be safe, avoiding any undesired behavior since we don't know exactly the side effects that this might cause

How does this PR make you feel?

@iago1501 iago1501 added the bug label Oct 1, 2024
@iago1501 iago1501 requested review from a team as code owners October 1, 2024 16:15
@iago1501 iago1501 requested review from gabpaladino, RodrigoTadeuF and leo-prange-vtex and removed request for a team October 1, 2024 16:15
Copy link
Contributor

vtex-io-ci-cd bot commented Oct 1, 2024

Hi! I'm VTEX IO CI/CD Bot and I'll be helping you to publish your app! 🤖

Please select which version do you want to release:

  • Patch (backwards-compatible bug fixes)

  • Minor (backwards-compatible functionality)

  • Major (incompatible API changes)

And then you just need to merge your PR when you are ready! There is no need to create a release commit/tag.

  • No thanks, I would rather do it manually 😞

@iago1501 iago1501 requested review from vsseixaso and vmourac-vtex and removed request for RodrigoTadeuF October 1, 2024 16:16
Copy link

@vmourac-vtex vmourac-vtex left a comment

Choose a reason for hiding this comment

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

LGTM!

@iago1501 iago1501 merged commit 2c431a7 into master Oct 2, 2024
4 of 6 checks passed
@iago1501 iago1501 deleted the fix/duplicated-structureddata branch October 2, 2024 14:27
Copy link
Contributor

vtex-io-ci-cd bot commented Oct 2, 2024

Your PR has been merged! App is being published. 🚀
Version 3.133.0 → 3.133.1

After the publishing process has been completed (check #vtex-io-releases) and doing A/B tests with the new version, you can deploy your release by running:

vtex deploy [email protected]

After that your app will be updated on all accounts.

For more information on the deployment process check the docs. 📖

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants