File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import type { ContentNavigationItem } from '@nuxt/content'
33import { findPageChildren } from ' @nuxt/content/utils'
44
55const route = useRoute ()
6+ const { framework } = useSharedData ()
67
78const navigation = inject <Ref <ContentNavigationItem []>>(' navigation' )
89
@@ -50,8 +51,20 @@ const categories = {
5051 }]
5152}
5253
54+ function filterChildrenByFramework(items : ContentNavigationItem []): ContentNavigationItem [] {
55+ return items .filter ((child ) => {
56+ if (! child .framework ) {
57+ return true
58+ }
59+
60+ return child .framework === framework .value
61+ })
62+ }
63+
5364function groupChildrenByCategory(items : ContentNavigationItem [], slug : string ): ContentNavigationItem [] {
54- const childrenGroupedByCategory = items .reduce ((acc , child ) => {
65+ const filteredItems = filterChildrenByFramework (items )
66+
67+ const childrenGroupedByCategory = filteredItems .reduce ((acc , child ) => {
5568 if (child .category ) {
5669 acc [child .category as string ] = [... (acc [child .category as string ] || []), child ]
5770 } else {
You can’t perform that action at this time.
0 commit comments