mirror of
https://github.com/nuxt/ui.git
synced 2026-09-14 19:51:10 +08:00
docs: the Figma entry links out, it is not a page
The sidebar followed the frontmatter `to`, but the surround, the sitemap, the llms sections, the raw markdown listing and the MCP resource each resolve the docs collection on their own, so each skips it now. The stub's own path and the old /figma page redirect to the kit.
This commit is contained in:
@@ -182,8 +182,10 @@ export const useNavigation = (navigation: Ref<ContentNavigationItem[] | undefine
|
||||
})
|
||||
|
||||
function findSurround(path: string, fwk: string = framework.value): [ContentNavigationItem | undefined, ContentNavigationItem | undefined] {
|
||||
// an entry with its own `to` (Figma) links out: nothing to step onto
|
||||
const flattenNavigation = navigationByCategory.value
|
||||
?.flatMap(item => filterChildrenByFramework(item, fwk, studioIcons)?.children) ?? []
|
||||
?.flatMap(item => filterChildrenByFramework(item, fwk, studioIcons)?.children)
|
||||
.filter(item => !item?.to) ?? []
|
||||
|
||||
const index = flattenNavigation.findIndex(item => item?.path === path)
|
||||
if (index === -1) {
|
||||
|
||||
@@ -78,7 +78,8 @@ export const collections = {
|
||||
// points at `to` instead of the page's own path.
|
||||
to: z.string().optional(),
|
||||
target: z.string().optional(),
|
||||
sitemap
|
||||
// an entry that links out is not a page to index
|
||||
sitemap: defineSitemapSchema({ z, name: 'docs', filter: entry => !entry.to })
|
||||
})
|
||||
}),
|
||||
showcase: defineCollection({
|
||||
|
||||
+8
-1
@@ -98,6 +98,9 @@ export default defineNuxtConfig({
|
||||
// the v2 to v3 guide lives with the v3 docs now
|
||||
'/docs/getting-started/migration/v3': { redirect: 'https://ui3.nuxt.com/getting-started/migration', prerender: false },
|
||||
'/docs/getting-started/theme': { redirect: '/docs/getting-started/theme/design-system', prerender: false },
|
||||
// the Figma guide lives with the kit now; the docs entry is a link, not a page
|
||||
'/figma': { redirect: { to: 'https://go.nuxt.com/figma-ui', statusCode: 301 }, prerender: false },
|
||||
'/docs/getting-started/figma': { redirect: { to: 'https://go.nuxt.com/figma-ui', statusCode: 301 }, prerender: false },
|
||||
'/docs/getting-started/integrations': { redirect: '/docs/getting-started/integrations/icons', prerender: false },
|
||||
'/docs/getting-started/ai': { redirect: '/docs/getting-started/ai/mcp', prerender: false },
|
||||
'/docs/composables': { redirect: '/docs/composables/define-shortcuts', prerender: false },
|
||||
@@ -274,6 +277,8 @@ export default defineNuxtConfig({
|
||||
{ path: '/', raw: '/raw/index.md' },
|
||||
'/docs/**'
|
||||
],
|
||||
// the Figma entry links out (routeRules above), there is no page to list or serve
|
||||
excludePrefixes: { extend: ['/docs/getting-started/figma'] },
|
||||
sitemap: {
|
||||
markdown: {
|
||||
// Split `/docs/**` into a section per area; `/blog/**` stays whole.
|
||||
@@ -445,7 +450,9 @@ export default defineNuxtConfig({
|
||||
title: 'Getting Started',
|
||||
contentCollection: 'docs',
|
||||
contentFilters: [
|
||||
{ field: 'path', operator: 'LIKE', value: '/docs/getting-started%' }
|
||||
{ field: 'path', operator: 'LIKE', value: '/docs/getting-started%' },
|
||||
// an entry that links out (Figma) has no page to include
|
||||
{ field: 'to', operator: 'IS NULL' }
|
||||
]
|
||||
}, {
|
||||
title: 'Components',
|
||||
|
||||
@@ -9,7 +9,8 @@ export default defineMcpResource({
|
||||
|
||||
const pages = await queryCollection(event, 'docs').all()
|
||||
|
||||
const result = pages.map(doc => ({
|
||||
// an entry with its own `to` (Figma) links out, there is no page to read
|
||||
const result = pages.filter(doc => !doc.to).map(doc => ({
|
||||
title: doc.title,
|
||||
description: doc.description,
|
||||
path: doc.path
|
||||
|
||||
Reference in New Issue
Block a user