Use different Breadcrumb Schema depending on presence/absence of Collection fields

Hi folks,

Been stumped on this for the last couple of hours so wondered if anyone could help.

I’m trying to add Breadcrumb Schema to one of my collection items.

The idea is to show google that even though the URL structure of the site is
Home > Collection > Collection Item

…The website is actually structured more like this:

Home > Category > Sub-Category > Collection Item

I can do this fine, because each Collection Item has a Reference Field where I select the Category or SubCategory. It’s all good…

I follow the guidance in this forum post and it all works great.

THE PROBLEM

The challenge comes in here because not all of my Collection Items have a Subcategory.
Some are kind of “the subcategory page” itself, so their Subcategory field is blank.

So the normal schema doesn’t work, because for those pages without a SubCategory, one of the breadcrumb items is blank – so Google does not approve.

I’ve tried resolving this with conditional logic, but Google doesn’t seem to run the logic and pick the correct one, it seems to simply scan the document and where it sees “@type”: “BreadcrumbList”, it retrieves the breadcrumbs.

This means that the pages which do not have a subcategory have 1 correct breadcrumb, but Google also finds 1 error (which I’m concerned may cause problems). And for the pages that do have a Subcategory, Google seems to prioritise the shortest breadcrumb, meaning the Subcategory is ignored anyway!

In Webflow we’re always encouraged to organise our CMS data and use Categories and Sub-Categories, and with more people being more and more SEO conscious and looking for opportunities to outrank their competitors, I’m guessing others will run into this issue too!

Any ideas folks? Would love some assistance!


Here is my public share link: https://preview.webflow.com/preview/yeshomebuyers?utm_medium=preview_link&utm_source=designer&utm_content=yeshomebuyers&preview=ceb126b5a7b6e085f78566e1573f30d7&pageId=609f9fdad8673ba767633aae&itemId=60a0d634f6a6107ddd464749&mode=preview