Skip to content
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

[WIP] Studio module integration into Content v3 #2836

Open
wants to merge 6 commits into
base: v3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/app/layouts/docs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { ContentNavigationItem } from '@nuxt/content'

const nav = inject<Ref<ContentNavigationItem[]>>('navigation')

const navigation = computed(() => nav?.value.find(item => item.path === '/docs')?.children || [])
const navigation = computed(() => nav?.value?.find(item => item.path === '/docs')?.children || [])
</script>

<template>
Expand Down
40 changes: 22 additions & 18 deletions docs/app/pages/docs/[...slug].vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,29 @@ if (!data.value || !data.value.page) {
throw createError({ statusCode: 404, statusMessage: 'Page not found', fatal: true })
}

const headline = computed(() => findPageHeadline(navigation.value, data.value.page))
const page = computed(() => data.value?.page)
const surround = computed(() => data.value?.surround)
const title = computed(() => page.value?.navigation?.title || page.value?.title)

const headline = computed(() => findPageHeadline(navigation.value, page.value))

useSeoMeta({
titleTemplate: '%s - Nuxt Content v3',
title: data.value.page.navigation?.title || data.value.page.title,
ogTitle: `${data.value.page.navigation?.title || data.value.page.title} - Nuxt Content v3`,
description: data.value.page.description,
ogDescription: data.value.page.description,
title: title.value,
ogTitle: `${title.value} - Nuxt Content v3`,
description: page.value?.description,
ogDescription: page.value?.description,
})

defineOgImageComponent('Docs', {
headline: headline.value,
title: data.value.page.title,
title: title.value,
})

const communityLinks = computed(() => [{
icon: 'i-lucide-pencil',
label: 'Edit this page',
to: `https://github.com/nuxt/content/edit/v3/docs/content/${data.value.page.stem}.${data.value.page.extension}`,
to: `https://github.com/nuxt/content/edit/v3/docs/content/${page.value?.stem}.${page.value?.extension}`,
target: '_blank',
}, {
icon: 'i-lucide-star',
Expand All @@ -49,43 +53,43 @@ const communityLinks = computed(() => [{
</script>

<template>
<UPage v-if="data.page">
<UPage v-if="page">
<UPageHeader
:title="data.page.title"
:links="data.page.links"
:title="page.title"
:links="page.links"
:headline="headline"
>
<template #description>
<MDC
v-if="data.page.description"
:value="data.page.description"
v-if="page.description"
:value="page.description"
unwrap="p"
/>
</template>
</UPageHeader>

<UPageBody>
<ContentRenderer
v-if="data.page.body"
:value="data.page"
v-if="page.body"
:value="page"
/>

<USeparator />

<UContentSurround :surround="(data.surround as any)" />
<UContentSurround :surround="surround" />
</UPageBody>

<template
v-if="data.page?.body?.toc?.links?.length"
v-if="page?.body?.toc?.links?.length"
#right
>
<UContentToc
:links="data.page.body.toc.links"
:links="page.body.toc.links"
class="z-[2]"
>
<template #bottom>
<USeparator
v-if="data.page.body?.toc?.links?.length"
v-if="page.body.toc.links.length"
type="dashed"
/>

Expand Down
9 changes: 9 additions & 0 deletions docs/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ export default defineNuxtConfig({
// url: process.env.TURSO_DATABASE_URL!,
// authToken: process.env.TURSO_AUTH_TOKEN!,
},
studio: {
enabled: true,
dev: true,
gitInfo: {
owner: 'larbish',
name: 'starter-larb',
url: 'https://github.com/larbish/starter-larb',
},
},
},

mdc: {
Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"defu": "^6.1.4",
"destr": "^2.0.3",
"fast-glob": "^3.3.2",
"git-url-parse": "^15.0.0",
"jiti": "^2.4.0",
"knitwork": "^1.1.0",
"listhen": "^1.9.0",
Expand All @@ -61,12 +62,16 @@
"micromark-util-resolve-all": "^2.0.0",
"micromark-util-sanitize-uri": "^2.0.0",
"micromatch": "^4.0.8",
"nuxt-component-meta": "^0.9.0",
"ohash": "^1.1.4",
"parse-git-config": "^3.0.0",
"pathe": "^1.1.2",
"pkg-types": "^1.2.1",
"remark-mdc": "^3.2.1",
"scule": "^1.3.0",
"shiki": "^1.22.2",
"slugify": "^1.6.6",
"socket.io-client": "^4.8.1",
"tar": "^7.4.3",
"typescript": "^5.6.3",
"ufo": "^1.5.4",
Expand Down
128 changes: 128 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading