UX: Show grandparent category badge in sticky header on desktop (#13184)

This commit is contained in:
Penar Musaraj 2021-05-27 11:35:28 -04:00 committed by GitHub
parent 855e854cb8
commit bcbb5b4dae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 0 deletions

View File

@ -126,6 +126,18 @@ export default createWidget("header-topic-info", {
const parentCategory = category.get("parentCategory");
const categories = [];
if (parentCategory) {
if (
this.siteSettings.max_category_nesting > 2 &&
!this.site.mobileView
) {
const grandParentCategory = parentCategory.get("parentCategory");
if (grandParentCategory) {
categories.push(
this.attach("category-link", { category: grandParentCategory })
);
}
}
categories.push(
this.attach("category-link", { category: parentCategory })
);