Skip to content

Commit ad47af0

Browse files
authored
docs(blog): update migration article
1 parent dc7d866 commit ad47af0

File tree

1 file changed

+48
-36
lines changed

1 file changed

+48
-36
lines changed

docs/content/blog/ui-pro-docs-migration.md

+48-36
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Migrate Nuxt UIPro Documentation Starter
2+
title: Migrate Nuxt UI Pro Documentation Starter
33
description: How to upgrade your Nuxt UI Pro documentation to Content and UIPro v3
44
image:
55
src: /blog/migrate-docs-starter.png
@@ -14,15 +14,15 @@ category: Migration
1414
draft: true
1515
---
1616

17-
# How to upgrade your Nuxt UI Pro docs website to Content and UI v3
17+
# How to upgrade your Nuxt documentation website to Content x UI v3
1818

1919
**2025 kicks off with the power of 3!**
2020

2121
This start of year is marked by major updates to our favorite tools. The UI team is about to launch **version 3** of the **UI / UI Pro libraries** (currently in alpha), while the Content team has already released **Nuxt Content v3**.
2222

2323
These updates mean that all our starter templates combining **Content** and **UI** will need to be updated to align with the latest versions. To help you make the transition, this guide walks through migrating the **Nuxt UI Pro Docs Starter** to the new **Content v3 and Nuxt UI v3** packages.
2424

25-
::prose-tip{to="https://github.com/nuxt-ui-pro/docs"}
25+
::prose-tip{to="https://github.com/nuxt-ui-pro/docs/tree/v3"}
2626
Check the UI Pro documentation starter repository source code.
2727
::
2828

@@ -32,19 +32,19 @@ Check the UI Pro documentation starter repository source code.
3232

3333
::code-group
3434
```bash [pnpm]
35-
pnpm add @nuxt/content@next
35+
pnpm add @nuxt/content@^3
3636
```
3737

3838
```bash [yarn]
39-
yarn add @nuxt/content@next
39+
yarn add @nuxt/content@^3
4040
```
4141

4242
```bash [npm]
43-
npm install @nuxt/content@next
43+
npm install @nuxt/content@^3
4444
```
4545

4646
```bash [bun]
47-
bun add @nuxt/content@next
47+
bun add @nuxt/content@^3
4848
```
4949
::
5050

@@ -89,15 +89,14 @@ The `type: page` means there is a 1-to-1 relationship between the content file a
8989
### 3. Migrate `app.vue`
9090

9191
::prose-steps{level="4"}
92-
9392
#### Navigation fetch can be updated by moving from `fetchContentNavigation` to `queryCollectionNavigation` method
9493

9594
:::prose-code-group
9695
```ts [app.vue (v3)]
9796
const { data: navigation } = await useAsyncData('navigation', () => queryCollectionNavigation('docs'))
98-
97+
9998
```
100-
99+
101100
```ts [app.vue (v2)]
102101
const { data: navigation } = await useAsyncData('navigation', () => fetchContentNavigation())
103102
```
@@ -111,7 +110,7 @@ The `type: page` means there is a 1-to-1 relationship between the content file a
111110
server: false,
112111
})
113112
```
114-
113+
115114
```ts [app.vue (v2)]
116115
const { data: files } = useLazyFetch<ParsedContent[]>('/api/search.json', {
117116
default: () => [],
@@ -124,14 +123,13 @@ The `type: page` means there is a 1-to-1 relationship between the content file a
124123
### 4. Migrate landing page
125124

126125
::prose-steps{level="4"}
127-
128126
#### Home page data fetching can be updated by moving from `queryContent` to `queryCollection` method
129127

130128
:::prose-code-group
131129
```ts [index.vue (v3)]
132130
const { data: page } = await useAsyncData('index', () => queryCollection('landing').path('/').first())
133131
```
134-
132+
135133
```ts [index.vue (v2)]
136134
const { data: page } = await useAsyncData('index', () => queryContent('/').findOne())
137135
```
@@ -156,7 +154,6 @@ useSeoMeta({
156154
### 5. Migrate catch-all docs page
157155

158156
::prose-steps{level="4"}
159-
160157
#### Docs page data and surround fetching can be updated and mutualised by moving from `queryContent` to `queryCollection` and `queryCollectionItemSurroundings` methods
161158

162159
:::prose-code-group
@@ -169,14 +166,14 @@ useSeoMeta({
169166
]), {
170167
transform: ([page, surround]) => ({ page, surround }),
171168
})
172-
169+
173170
const page = computed(() => data.value?.page)
174171
const surround = computed(() => data.value?.surround)
175172
```
176-
173+
177174
```ts [docs/[...slug\\].vue (v2)]
178175
const { data: page } = await useAsyncData(route.path, () => queryContent(route.path).findOne())
179-
176+
180177
const { data: surround } = await useAsyncData(`${route.path}-surround`, () => queryContent()
181178
.where({ _extension: 'md', navigation: { $ne: false } })
182179
.only(['title', 'description', '_path'])
@@ -248,26 +245,25 @@ This is a migration case, it won't cover all breaking changes introduced by the
248245
### 1. Setup package to v3
249246

250247
::prose-note
251-
To maintain consistency with the UI versioning, which transitioned from v1 to v2. The Nuxt UIPro version 2 is being skipped, and the update jumps directly to v3.
248+
To maintain consistency with the UI versioning, which transitioned from v1 to v2. The Nuxt UI Pro version 2 is being skipped, and the update jumps directly to v3.
252249
::
253250

254251
::prose-steps{level="4"}
255-
256252
#### Install the Nuxt UI v3 alpha package
257253

258254
:::code-group{sync="pm"}
259255
```bash [pnpm]
260256
pnpm add @nuxt/ui-pro@next
261257
```
262-
258+
263259
```bash [yarn]
264260
yarn add @nuxt/ui-pro@next
265261
```
266-
262+
267263
```bash [npm]
268264
npm install @nuxt/ui-pro@next
269265
```
270-
266+
271267
```bash [bun]
272268
bun add @nuxt/ui-pro@next
273269
```
@@ -283,7 +279,7 @@ It's no longer required to add `@nuxt/ui` in modules as it is automatically impo
283279
modules: ['@nuxt/ui-pro']
284280
})
285281
```
286-
282+
287283
```ts [nuxt.config.ts (v1)]
288284
export default defineNuxtConfig({
289285
extends: ['@nuxt/ui-pro'],
@@ -487,7 +483,6 @@ This decision was made because components used in Markdown no longer need to be
487483
::
488484

489485
::prose-steps{level="4"}
490-
491486
#### Update content configuration
492487

493488
```ts [content.config.ts]
@@ -527,7 +522,7 @@ export default defineContentConfig({
527522
</UContainer>
528523
</template>
529524
```
530-
525+
531526
```vue [index.vue (v1)]
532527
<template>
533528
<div>
@@ -553,27 +548,27 @@ export default defineContentConfig({
553548
aria-hidden="true"
554549
/>
555550
</NuxtLink>
556-
551+
557552
{{ page.hero.headline.label }}
558-
553+
559554
<UIcon
560555
v-if="page.hero.headline.icon"
561556
:name="page.hero.headline.icon"
562557
class="ml-1 w-4 h-4 pointer-events-none"
563558
/>
564559
</UBadge>
565560
</template>
566-
561+
567562
<template #title>
568563
<MDC :value="page.hero.title" />
569564
</template>
570-
565+
571566
<MDC
572567
:value="page.hero.code"
573568
class="prose prose-primary dark:prose-invert mx-auto"
574569
/>
575570
</ULandingHero>
576-
571+
577572
<ULandingSection
578573
:title="page.features.title"
579574
:links="page.features.links"
@@ -611,7 +606,6 @@ Landing components have been reorganised and standardised as generic `Page` comp
611606
### 6. Migrate docs page
612607

613608
::prose-steps{level="4"}
614-
615609
#### Layout
616610

617611
- `Aside` component has been renamed to `PageAside` .
@@ -632,13 +626,13 @@ Landing components have been reorganised and standardised as generic `Page` comp
632626
/>
633627
</UPageAside>
634628
</template>
635-
629+
636630
<slot />
637631
</UPage>
638632
</UContainer>
639633
</template>
640634
```
641-
635+
642636
```vue [layout/docs.vue (v1)]
643637
<template>
644638
<UContainer>
@@ -648,7 +642,7 @@ Landing components have been reorganised and standardised as generic `Page` comp
648642
<UNavigationTree :links="mapContentNavigation(navigation)" />
649643
</UAside>
650644
</template>
651-
645+
652646
<slot />
653647
</UPage>
654648
</UContainer>
@@ -664,7 +658,25 @@ Landing components have been reorganised and standardised as generic `Page` comp
664658
::
665659

666660
::prose-tip{to="https://github.com/nuxt-ui-pro/docs/tree/v3"}
667-
That's it! The docs starter is now fully running on both UI and Content v3 🎉 You check out the source code on GitHub.
661+
That's it! The docs starter is now fully running on both UI and Content v3 🎉
668662
::
669663

670-
## Bonus: Edit on Studio
664+
## Edit on Studio
665+
666+
If you're using Nuxt Studio to edit your documentation you also need to migrate the related code.
667+
668+
The Studio module has been deprecated and a new generic `Preview API` has been implemented directly into Nuxt Content, you can remove the `@nuxthq/studio` package from your dependencies and from the`nuxt.config.ts` modules. Instead you just need to enable the preview mode in the Nuxt configuration file by binding the Studio API.
669+
670+
```ts [nuxt.config.ts]
671+
export default defineNuxtConfig({
672+
content: {
673+
preview: {
674+
api: 'https://api.nuxt.studio'
675+
}
676+
},
677+
})
678+
```
679+
680+
In order to keep the app config file updatable from Studio you need to update the helper import of the `nuxt.schema.ts` file from `@nuxthq/studio/theme` to `@nuxt/content/preview`.
681+
682+
:video{autoplay controls loop poster="https://res.cloudinary.com/nuxt/video/upload/v1737458923/studio/docs-v3_lqfasl.png" src="https://res.cloudinary.com/nuxt/video/upload/v1737458923/studio/docs-v3_lqfasl.mp4"}

0 commit comments

Comments
 (0)