Skip to content
This repository was archived by the owner on Sep 22, 2023. It is now read-only.

Commit 21c951f

Browse files
committed
Finetune snippet breadcrumbs
Parented collection snippets will link to the parent collection instead of the default tag.
1 parent fcc4f32 commit 21c951f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/blocks/models/snippet.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,15 @@ export const snippet = {
152152
}/t/${snippet.primaryTag.toLowerCase()}/p/1`,
153153
name: literals.tag(snippet.primaryTag),
154154
};
155+
} else if (
156+
snippet.hasCollection &&
157+
snippet.collections.first.listing.parent
158+
) {
159+
// TODO: Make this smarter to account for multiple collections
160+
tagCrumb = {
161+
url: `/${snippet.collections.first.slug}/p/1`,
162+
name: snippet.collections.first.shortName,
163+
};
155164
} else if (
156165
snippet.language &&
157166
snippet.truePrimaryTag &&

0 commit comments

Comments
 (0)