Skip to content

No breadcrumbs wrapping control #22094

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

Open
2 tasks done
rsepierre opened this issue Mar 10, 2025 · 0 comments
Open
2 tasks done

No breadcrumbs wrapping control #22094

rsepierre opened this issue Mar 10, 2025 · 0 comments

Comments

@rsepierre
Copy link

rsepierre commented Mar 10, 2025

  • 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

Wrapping happens randomly before or after breadcrumbs separator. No control

Image

To Reproduce

Step-by-step reproduction instructions

  1. Have too long of a title to fit on one line
  2. Will randomly wrap before or after a separator

Expected results

  1. Either always wrap before, wrap after, or have option to chose

Actual results

  1. Not able to control, hardcoded and unfilterable

Screenshots, screen recording, code snippet

	/**
	 * Retrieves the separator.
	 *
	 * @return string The separator.
	 */
	protected function get_separator() {
		if ( ! $this->separator ) {
			$this->separator = \apply_filters( 'wpseo_breadcrumb_separator', $this->helpers->options->get( 'breadcrumbs-sep' ) );
			$this->separator = ' ' . $this->separator . ' ';
		}

		return $this->separator;
	}

Solutions option :

1. Best but somewhat breaking for current wpseo_breadcrumb_separator filter users :
Apply wpseo_breadcrumb_separator filter AFTER this->separator = ' ' . $this->separator . ' ';
(if a developer is going through the process of using a filter, he would probably be able to add spaces on his own.

2. Easier to implement and reasonable, non-breaking
Use   either before or after $this->separator instead of ' ' so wrapping is not random. Do not use   before and after

3. Best option aswel but maybe overkill, non-breaking
Add option to choose whether to wrap before or after a separator

4. Best and can be non breaking
Do not add hardcoded spaces at all in the get_separator() method
Let users set the full separator string in the input field. Some users might not want spaces at all.
To make it non breaking, swap current separator value with ' ' + current separator + ' ' in the database when user updates yoast SEO (https://developer.wordpress.org/reference/hooks/upgrader_process_complete/).
Make default value hold spaces aswel

5. Ok and non breaking, can be added/combined with other solutions
Wrap separator in a <span class="separatorClass">' ' + separator + ' '</span>
Although not perfect since it would still hold hardcoded spaces, it could still enable developers to look for a css solution. Separators are currently not targetable at all in any way.
Image

Technical info

irrelevent

Used versions

  • Yoast SEO version: 24.6
@josevarghese josevarghese changed the title No breadcrumbs wrapping control, poorly implemented wordpress filter No breadcrumbs wrapping control Apr 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant