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

[Feature Request] Allow Yoast SEO Breadcrumbs to be displayed in a list order #5055

Open
Pcosta88 opened this issue Jun 30, 2016 · 5 comments

Comments

@Pcosta88
Copy link
Contributor

Add an option for the Yoast SEO Breadcrumbs to be displayed as either an ordered or unordered list.

See also: https://wordpress.org/support/topic/plugin-yoast-breadcrumbs-links-as-list-items?replies=1
https://wordpress.org/support/topic/plugin-wordpress-seo-by-yoast-breadcrumb-semantic-markup?replies=1

@Pcosta88
Copy link
Contributor Author

Please inform the customer of conversation # 129955 when this conversation has been closed.

@Pcosta88
Copy link
Contributor Author

Pcosta88 commented Mar 3, 2017

Please inform the customer of conversation # 183023 when this conversation has been closed.

@jonoalderson
Copy link

jonoalderson commented Oct 18, 2018

This is sensible; semantically, these breadcrumbs are a structured list. I think we should provide an upgrade roue to alter the markup (a new function/shortcode).

We should also output a enqueue a yoast-breadcrumbs.css stylesheet, to ensure that we don't output theme/native CSS on these elements.

Specifically, we should:

  • Add a new shortcode/function for generating 'V2 breadcrumbs' (e.g., yoast_breadcrumb_v2).
  • Alter the markup to use an ordered list
  • Add a new class to the breadcrumb container (to minimise specificity collisions on existing CSS)
  • Add a new class for the first breadcrumb item (breadcrumb_first)
  • Link the last/current element to the (canonical URL of) the current page
  • Enqueue the CSS below

Alternatively, we could offer a filter/function to apply a custom 'walker' function (as per wp nav menu and similar) and wrapper function, which would allow advanced users to construct their own markup.

Example markup

<ol class="yoast_breadcrumbs">
    <li class="yoast_breadcrumb yoast_breadcrumb--first"><a href="https://www.example.come/">Home</a></li>
    <li class="yoast_breadcrumb"><a href="https://www.example.come/test-page/">Test Page</a></li>
    <li class="yoast_breadcrumb yoast_breadcrumb--last"><a aria-current="page" href="https://www.example.come/test-page/test-page-2/">Test Page 2</a></li>
</ol>

CSS

I think this should be pretty safe and consistent, but, feel free to adjust/adapt it if I've missed or messed up anything.

.yoast_breadcrumbs {
  display: block;
  list-style: none;
  margin: 0;
  padding: 0;
}
.yoast_breadcrumbs::after {
  content: "";
  clear: both;
  display: table;
}
.yoast_breadcrumbs > li.yoast_breadcrumb {
    float: left;
    margin: 0 6px 0 0;
    padding: 0;
}
.yoast_breadcrumbs > li.yoast_breadcrumb::after {
    content: "»";
    margin: 0 0 0 6px;
}
.yoast_breadcrumbs > li.yoast_breadcrumb--last::after {
    content: unset;
    margin: unset;
}

@rmarcano
Copy link

Received a request for this feature here: https://twitter.com/blueocto/status/1231979105953964033

@juliemoynat
Copy link

Hi,
It would be great to have this feature implemented for accessibility because semantic is part of web accessibility. Navigating through a list into something that is actually a list is easier than navigating into a paragraph.
Thanks

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

No branches or pull requests

9 participants