Skip to content

Commit

Permalink
refactor: simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Mar 14, 2024
1 parent 0a7fa72 commit 5dd64ba
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 79 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Minimal Documentation Theme and CLI for shared usage across UnJS projects.

Made with [Nuxt](https://nuxt.com/), [Nuxt Content](https://content.nuxt.com), [Nuxt SEO](https://nuxtseo.com) and [Nuxt UI Pro](https://ui.nuxt.com/pro).
Made with [Nuxt](https://nuxt.com/), [Nuxt Content](https://content.nuxt.com) and [Nuxt UI Pro](https://ui.nuxt.com/pro).

👉 Docs: https://undocs.pages.dev/

Expand Down
15 changes: 1 addition & 14 deletions app/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const ssr = Boolean(isProd || process.env.NUXT_DOCS_SSR)

export default defineNuxtConfig({
ssr,
modules: ['@nuxt/fonts', '@nuxt/content', '@nuxtjs/seo', isProd && '@nuxtjs/plausible', '@nuxt/ui'],
modules: ['@nuxt/fonts', '@nuxt/content', isProd && '@nuxtjs/plausible', '@nuxt/ui'],
ui: {
icons: [],
},
Expand Down Expand Up @@ -68,19 +68,6 @@ export default defineNuxtConfig({
debug: false,
fonts: ['Nunito:400', 'Nunito:700'],
},
seo: {
splash: false,
},
schemaOrg: {
enabled: ssr,
},
sitemap: {
strictNuxtContentPaths: true,
},
linkChecker: {
strictNuxtContentPaths: true,
skipInspections: ['link-text'],
},
tailwindcss: {
viewer: dev,
quiet: !dev,
Expand Down
56 changes: 14 additions & 42 deletions app/pages/[...slug].vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,6 @@ useSeoMeta({
description: page.value?.description,
})
if (process.server) {
// @ts-ignore
useSchemaOrg([
// @ts-ignore
defineArticle({
'@type': 'TechArticle',
}),
])
}
if (process.server) {
// @ts-ignore
defineOgImageComponent('OgImageDocs')
}
const headline = computed(() => findPageHeadline(page.value))
const tocOpen = ref(false)
Expand All @@ -68,22 +53,12 @@ onMounted(() => {
<UPageHeader :title="page.title" :description="page.description" :links="page.links" :headline="headline">
</UPageHeader>

<div
v-if="tocLinks.length > 1"
class="float-right mt-4 top-[calc(var(--header-height)_+_0.5rem)] z-10 flex justify-end sticky"
>
<UDropdown
:items="[[{ label: 'Return to top', click: scrollToTop }], tocLinks]"
:popper="{ placement: 'bottom-end' }"
:mode="isMobile ? 'click' : 'hover'"
v-model:open="tocOpen"
>
<UButton
color="white"
label="On this page"
:trailing="false"
:icon="`i-heroicons-chevron-${tocOpen ? 'down' : 'left'}-20-solid`"
/>
<div v-if="tocLinks.length > 1"
class="float-right mt-4 top-[calc(var(--header-height)_+_0.5rem)] z-10 flex justify-end sticky">
<UDropdown :items="[[{ label: 'Return to top', click: scrollToTop }], tocLinks]"
:popper="{ placement: 'bottom-end' }" :mode="isMobile ? 'click' : 'hover'" v-model:open="tocOpen">
<UButton color="white" label="On this page" :trailing="false"
:icon="`i-heroicons-chevron-${tocOpen ? 'down' : 'left'}-20-solid`" />
</UDropdown>
</div>

Expand All @@ -95,17 +70,14 @@ onMounted(() => {
<div class="space-y-6">
<UDivider type="dashed" />
<div class="mb-4">
<UPageLinks
class="inline-block"
:links="[
{
icon: 'i-ph-pen-duotone',
label: 'Edit this page on GitHub',
to: `https://github.com/${appConfig.docs.github}/edit/main/docs/${page._file}`,
target: '_blank',
},
]"
/>
<UPageLinks class="inline-block" :links="[
{
icon: 'i-ph-pen-duotone',
label: 'Edit this page on GitHub',
to: `https://github.com/${appConfig.docs.github}/edit/main/docs/${page._file}`,
target: '_blank',
},
]" />
</div>
<UContentSurround v-if="surround?.length" class="mb-4" :surround="surround" />
</div>
Expand Down
26 changes: 8 additions & 18 deletions app/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ useSeoMeta({
description: page.value!.description,
})
if (process.server) {
// @ts-ignore
defineOgImageComponent('OgImageDocs')
}
function nornalizeHeroLinks(links: LandingConfig['heroLinks']) {
return Object.entries(links || {})
.map(([key, link], order) => {
Expand Down Expand Up @@ -92,19 +87,14 @@ const hero = computed(() => {
<template v-if="page.features?.length > 0 && !hero.withFeatures">
<ULandingSection :title="page.featuresTitle">
<UPageGrid>
<ULandingCard
v-for="(item, index) of page.features"
:key="index"
v-bind="item"
:ui="{
icon: {
// If the icon is an emoji, we need to use a bigger size
base: /\p{Emoji}/u.test(item.icon)
? '!text-2xl !w-auto !h-auto'
: 'w-8 h-8 flex-shrink-0 text-gray-900 dark:text-white',
},
}"
>
<ULandingCard v-for="(item, index) of page.features" :key="index" v-bind="item" :ui="{
icon: {
// If the icon is an emoji, we need to use a bigger size
base: /\p{Emoji}/u.test(item.icon)
? '!text-2xl !w-auto !h-auto'
: 'w-8 h-8 flex-shrink-0 text-gray-900 dark:text-white',
},
}">
<template v-if="item.description" #description>
<MDC :value="item.description" tag="p" class="prose prose-primary dark:prose-invert" />
</template>
Expand Down
Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/.config/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ landing:
description: 'Focus on writing your *documentation* with Markdown, not tooling.'
- title: 'Nuxt powered'
icon: 'logos:nuxt-icon'
description: 'Made with [Nuxt](https://nuxt.com), Nuxt Content, Nuxt SEO and Nuxt UI Pro.'
description: 'Made with [Nuxt](https://nuxt.com), [Nuxt Content](https://content.nuxt.com/), and [Nuxt UI Pro](https://ui.nuxt.com/pro).'
- title: 'Deploy anywhere'
icon: ''
description: 'The documentation can be hosted on any static hosting.'
2 changes: 1 addition & 1 deletion docs/1.guide/1.index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

UnJS Docs is a minimal Documentation Theme and CLI for shared usage across UnJS projects.

It is made with [Nuxt](https://nuxt.com/), [Nuxt Content](https://content.nuxt.com), [Nuxt SEO](https://nuxtseo.com) and [Nuxt UI Pro](https://ui.nuxt.com/pro) with a zero config and elegant CLI wrapper.
It is made with [Nuxt](https://nuxt.com/), [Nuxt Content](https://content.nuxt.com), and [Nuxt UI Pro](https://ui.nuxt.com/pro) with a zero config and elegant CLI wrapper.

## Quick Start

Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"@nuxt/fonts": "^0.3.0",
"@nuxt/ui-pro": "^1.0.2",
"@nuxtjs/plausible": "^0.2.4",
"@nuxtjs/seo": "^2.0.0-rc.9",
"@nuxtjs/tailwindcss": "^6.11.4",
"automd": "^0.3.6",
"c12": "^1.10.0",
Expand Down Expand Up @@ -66,4 +65,4 @@
"vue-tsc": "^2.0.6"
},
"packageManager": "bun@1.0.26"
}
}

0 comments on commit 5dd64ba

Please sign in to comment.