Yoast / Yoast/wordpress-seo

Rest api yoast_head breadcrumbList on frontpage has the same item twice.

Open
#16,632 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

severity: minor Yoast: SEO Features
Dominant language
JavaScript
Stars
2k
Forks
975
Avg merge
3d 13h
Merged PRs (30d)
36

Description

  • I've read and understood the contribution guidelines.
  • I've searched for any related issues and avoided creating a duplicate issue.
Please give us a description of what happened.

When getting the yoast_head property on the home page via the REST api, the breadcrumbsList has two of the same items, both being the homepage.
This problem does not occur in what yoast generates in the head of my website itself.

I've included both the page html, and the REST api response in the zip below.
You can see the issue when you compare the json ld data in the html, and the data in the rest api field.

frontpage-yoast-json-ld-bug.zip

image

Please describe what you expected to happen and why.

I would expect that the output in the REST api is the same as what's generated in the <head> tag.
For the frontpage, this is only one breadcrubList item.

How can we reproduce this behavior?
  1. Create a WordPress installation, and install the yoast plugin.
  2. In WordPress reading settings, choose to use a static page as the homepage, and select a page.
  3. Enable breadcrumbs in yoast settings
  4. Get the ID from the selected page, and visit the rest url https://WORDPRESS_URL/wp-json/wp/v2/pages/HOMEPAGE_ID.
Technical info
  • If relevant, which editor is affected (or editors):
  • Classic Editor
  • Gutenberg
  • Classic Editor plugin
  • Which browser is affected (or browsers):
  • Chrome
  • Firefox
  • Safari
  • Other
Used versions
  • WordPress version: 5.6.1
  • Yoast SEO version: 15.7
  • Gutenberg plugin version:
  • Classic Editor plugin version:
  • Relevant plugins in case of a bug:
  • Tested with theme: Twenty Twenty-One

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue through the REST endpoint /wp-json/wp/v2/pages/HOMEPAGE_ID after selecting a static homepage and enabling breadcrumbs. Compare the yoast_head JSON-LD with the page’s head output, using the attached HTML and REST response as references. Done means the REST response contains one homepage breadcrumb item, matching the head output.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.