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

Improve Breadcrumbs block using WordPress SEO logic #2

Closed
bobbingwide opened this issue Jul 30, 2020 · 2 comments
Closed

Improve Breadcrumbs block using WordPress SEO logic #2

bobbingwide opened this issue Jul 30, 2020 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@bobbingwide
Copy link
Owner

In the prototyped version of the block ( #1 ) I implemented a call to yoast_breadcrumb() if it was available.

When the Breadcrumbs setting was Disabled then the function returned null, so the code then defaulted to my own logic.

When the Breadcrumbs setting was Enabled then the breadcrumb was displayed.

But, the results in the editor didn't match the results in the browser.
In the editor I just get "Home"
In the front-end the trail includes archive links for CPTs.

e.g. when viewing
https://s.b/oikcom/block/breadcrumbs-block-sb-breadcrumbs-block/

the trail is:

'Ome » Blocks » Breadcrumbs block – sb/breadcrumbs-block

where:

  • 'Ome is the string I've chosen for for Home
  • » is the default separator
  • and the values to the left of the separators are linked to the substring of the permalink.

Requirement

To get the same output in the editor as in the front-end.

Proposed solution

Don't know yet, but see if there's anything happening in... Yoast/wordpress-seo#14204

@bobbingwide
Copy link
Owner Author

bobbingwide commented Jul 30, 2020

Intermediate solution

When the block is being rendered with Server Side Rendering, i.e. when it's a REST_REQUEST, then we won't call the WordPress SEO logic. We just use the default function sb_breadcrumbs_block_dynamic_block_internal()

The block will look slightly different from the front end since it won't be picking up the user defined / default values for "Home" and the separator. Perhaps we should make these block settings.

@bobbingwide bobbingwide changed the title Improve Breadcrumb block using WordPress SEO logic Improve Breadcrumbs block using WordPress SEO logic Jul 30, 2020
@bobbingwide
Copy link
Owner Author

v0.6.0 now released with server side rendering support for Yoast SEO's breadcrumbs logic.
Note: Yoast SEO provides its own breadcrumbs block.

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

No branches or pull requests

1 participant