-
-
Notifications
You must be signed in to change notification settings - Fork 661
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Grouped content #3119
Comments
Maybe could be done with settings navigation to false for that folder? |
This is a great idea, especially for blogs with a large number of articles. I also really need this feature. However, the question that comes with it is: when users click on the link, such as "blog (3)" in the interface, what will they see? Do we need to create a separate article list UI for each group route? I don't have a perfect solution yet. @stijns96, do you have any thoughts on this? |
Hi @AssetCEO , For me it functions as a category filter. I modify my object so it contains a To me it would be handy if that grouped folder is ignored or stripped out from the queryNavigation and queryCollection. Or at least add an extra property to the object. E.g. |
Hi @AssetCEO, So here is my code to fix it for my project: /**
* Get the content navigation for the current page.
*/
const { data: contentNavigation } = await useAsyncData(
`${route.path}-navigation`,
() => queryCollectionNavigation(componentType.value, ['meta']),
{
transform: (data) => data[0].children[0].children // Directly strip out unused folder items
}
);
/**
* Create the grouped content navigation items.
*/
const groupedContentNavigationItem = computed(() => {
return contentNavigation.value
.filter(({ folder }) => folder)
.map((item) => {
return {
...item,
title: item.title,
children: item.children.map(formatItem)
};
});
});
/**
* Create the content navigation items.
*/
const contentNavigationItems = computed(() => {
return contentNavigation.value
.filter(({ folder }) => !folder)
.map(formatItem);
}); I'm filtering this based on a value from the title: Title
folder: true This results in: ![]() ![]() The grouped items are at the top, while the flat items will be placed below the groups. <UPage>
<template #left>
<UPageAside>
<template #top>
<UNavigationMenu
:items="componentsNavigation"
orientation="vertical"
variant="link"
/>
</template>
<USeparator type="dashed" :ui="{ root: 'mb-8' }" />
<UContentNavigation
:navigation="groupedContentNavigationItem"
variant="link"
/>
<UContentNavigation
:navigation="contentNavigationItems"
variant="link"
/>
</UPageAside>
</template>
</UPage> |
Is your feature request related to a problem? Please describe
I'm creating a docs for a big scala of sections and snippets where I want to group variants together. E.g. a content section can have 70 variations, but other sections as well. I want them all to be accessible as
./components/sections/section-name-1
etc. Not like./components/sections/section-group/section-name-1
/ Mainly because of the content navigation.Describe the solution you'd like
Actually the same behaviour of the Nuxt grouped pages solution.
The think is that I want to group sections into categories, but don't want them to be grouped in the fetched navigation.
The text was updated successfully, but these errors were encountered: