Q:

How to display the parent category on an entry page?

I have a simple Craft 3 website, with products that are organised in categories.
Can someone please tell me how to do the following:
On the the individual product pages (_entry.html) display a 'breadcrumb' menu that includes the parent category name/url (I've followed the few examples posted here - they don't work).
And also be able to simply display the name of the parent category of the product in text (e.g. to use as part of the h1 title for the product page).
Many thanks for your help - it is very much appreciated!

A:

Assuming your categories are accessible from a Categories field called 'productCategory', and you only have 1 category assigned to each product, you can display the name of the parent category with:
{{ entry.productCategory.one() }}

Or you can loop through multiple Categories with:
{% for category in entry.productCategory.all() %}
    {{ category.title }}
{% endfor %}

And to get the category link for your breadcrumb, you could use something like:
{{ entry.productCategory.one().slug }}

