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

Breadcrumbs v2: add hierarchy, title, and other options. #668

Open
sybrew opened this issue Mar 4, 2024 · 14 comments
Open

Breadcrumbs v2: add hierarchy, title, and other options. #668

sybrew opened this issue Mar 4, 2024 · 14 comments
Labels
Breadcrumbs nomnom [Type] Feature Something new we need to write from the ground up.
Milestone

Comments

@sybrew
Copy link
Owner

sybrew commented Mar 4, 2024

From various requests*1:

  1. Allow the selection of a breadcrumb title type: SEO title or Meta Title.
    I'll mark all titles that do not follow a default method with "discrepancy."

  2. Also, allow to select a breadcrumb hierarchy per request type (post type, date, home, etc.):
    For example, do not use product categories for a product, but do use categories for a post.

These issues are combined because we'd have to implement a new interface for breadcrumbs specifically.
Yet, most people would be happy when allowed to toggle the breadcrumb title type already. So, splitting this issue into two might still happen.

*1:

  1. https://wordpress.org/support/topic/use-wordpress-title-instead-of-seo-title-for-breadcrumbs-option/
  2. https://wordpress.org/support/topic/use-hooks-filters-to-optimize-the-display-of-breadcrumbs-shortcode/
  3. https://wordpress.org/support/topic/breadcrumbs-155/
  4. https://wordpress.org/support/topic/suggestions-for-improving-the-plugin-2/
  5. https://wordpress.org/support/topic/remove-shop-base-from-tsf-breadcrumbs/
@sybrew sybrew added [Type] Feature Something new we need to write from the ground up. Breadcrumbs nomnom labels Mar 4, 2024
@sybrew
Copy link
Owner Author

sybrew commented Mar 4, 2024

Users also requested a custom breadcrumb name field for posts and terms.

@sybrew
Copy link
Owner Author

sybrew commented Mar 4, 2024

"Should we affect only the structured data JSON or the shortcode?"

I'd vote for having them affected both simultaneously; not independently tweakable.

The breadcrumb hierarchy generation is cached. So, once it's done generating for the structured data, we can reuse that for the breadcrumb shortcode. Repeated use of the shortcode would only regenerate the HTML, not the hierarchy, thus avoiding all expensive (database) requests.

The breadcrumb generation is one of the most expensive things TSF does regarding performance. Doubling its impact isn't welcome.

@datgausaigon
Copy link

It's nice to hear you implement this feature. Do you plan to publish this feature anytime soon?
Love your work ❤️

@sybrew
Copy link
Owner Author

sybrew commented Mar 27, 2024

I'm still collecting data and planning this feature, and I have other features to attend to, so please do not hold your breath just yet.

@sybrew
Copy link
Owner Author

sybrew commented Mar 27, 2024

Another user used the breadcrumb shortcode under the title, which wasn't pretty. Removing the current page's breadcrumb fixed that.

Still, we shouldn't remove the current page crumb from the Schema.org output. This must be sieved out during the shortcode generation.

The user also benefited from adding padding-inline-start: 0 and converting the display to a flexbox. The flexbox output helps to break entire crumbs instead of only words.

@datgausaigon
Copy link

datgausaigon commented Mar 27, 2024

My best practice when layout and css is set all element padding, margin to 0. I must css for tsf-breadcrumb

.tsf-breadcrumb > ol {
    padding-left: 0;
}

@datgausaigon
Copy link

Hi, I have a custom css for tsf-breadcrumb

.tsf-breadcrumb ol, .tsf-breadcrumb li {
    display: inline-block;
}

@datgausaigon
Copy link

Hi @sybrew ,
I have some idea for this issue. Hope this helps you.
We should have this options:

  • Hide "Home" in Breadcrumbs
  • Hide "Shop" in Breadcrumbs with WooCommerce
  • Hide "Post Title" in Breadcrumbs
  • Display only Primary Term
  • Display Root Term > Primary Term
  • Display Root Term > Parent Term(s) > Primary Term
  • Use Post Title instead of Meta Title

@sybrew sybrew added this to the 5.1.0 milestone Apr 16, 2024
@sybrew
Copy link
Owner Author

sybrew commented Aug 23, 2024

A user also requested to remove the current post from the breadcrumb.

To do this visually, please use this CSS:

.tsf-breadcrumb .breadcrumb-item:last-child {
    display: none;
}

.tsf-breadcrumb .breadcrumb-item:nth-last-child(2):after {
    display: none;
}

Alternatively, you can use this filter in PHP to account for custom classes:

add_filter(
	'the_seo_framework_breadcrumb_shortcode_css',
	function ( $css, $class ) {

		$css["nav.$class li:last-child"][] = 'display:none';
		$css["nav.$class li:nth-last-child(2):after"][] = 'display:none';

		return $css;
	},
	10,
	2,
);

@rally-lad
Copy link

Any news on this planned update?

Fantastic plugin by the way. Just the breadcrumb structure pulling the meta title is stopping our design studio using it across the board.

Hope it can be implemented soon.

Keep up the great work.

@sybrew
Copy link
Owner Author

sybrew commented Nov 15, 2024

Thanks :)

This rework of breadcrumbs is planned for TSF v5.2.
However, v5.1 has yet to be released. For a general timeline, note that v5.0 was released nearly a year ago, so please look for alternative solutions if needed.

In any case, we should probably replace the Meta\Title::get_bare_title() calls with a new get_breadcrumb_title() call, where we can easily switch over settings. We shouldn't care too much about the structured data; instead, we should let that mimic what the user sees on the front end.

@rally-lad
Copy link

I’ll continue to use the other tools on the market for the time being but I’ll be keeping a close eye on this as I’ll happily make the switch when that has been implemented. I do love the bare bones feel and speed of your plugin.

@sybrew sybrew changed the title Add breadcrumb title and hierarchy options Breadcrumbs v2: add hierarchy, title, and other options. Nov 29, 2024
@sybrew
Copy link
Owner Author

sybrew commented Dec 7, 2024

Another user suggested (via email):

Set a max crumb length and replace or hide parent crumbs.
e.g.

From: Home > Category grandparent > Category parent > Category > Page
To  : Home > ... > Category > Page
Or  : Home > Category > Page

We should not permit trimming fewer than 3 crumbs, even though some might find that aesthetically better; it would indicate that WordPress's Post Type and Taxonomy relationships are being used incorrectly. Allowing this to be hidden will not solve that problem.

@sybrew
Copy link
Owner Author

sybrew commented Jan 21, 2025

From #705:

  1. Allow hiding taxonomies from the breadcrumb list.
  2. Allow hiding archive basis from the breadcrumb list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Breadcrumbs nomnom [Type] Feature Something new we need to write from the ground up.
Projects
None yet
Development

No branches or pull requests

3 participants