Skip to content

Commit

Permalink
docs: ??
Browse files Browse the repository at this point in the history
  • Loading branch information
harlan-zw committed Oct 29, 2024
1 parent 7cccfe6 commit f7c8bda
Show file tree
Hide file tree
Showing 6 changed files with 581 additions and 303 deletions.
2 changes: 1 addition & 1 deletion docs/app/components/DocsSidebarHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const files = computed(() => _nav.value?.files.value || [])
{{ link.title }}
</div>
</div>
<div v-else v-html="link.html" />
<div v-else v-html="link.title" />
</template>
</ContentNavigation>
</nav>
Expand Down
4 changes: 3 additions & 1 deletion docs/app/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,8 @@ const graphData = computed(() => {
return acc
}, [])
})
const isNuxtSeoStableReleased = false
</script>

<template>
Expand Down Expand Up @@ -517,7 +519,7 @@ const graphData = computed(() => {
<div class="gradient" />
<section class="xl:max-w-full max-w-3xl mx-auto py-5 sm:py-12 xl:py-20">
<UContainer>
<div class="mb-5 sm:mb-0">
<div v-if="isNuxtSeoStableReleased" class="mb-5 sm:mb-0">
<div class="sm:inline-flex block mb-5 gap-3 inline px-3 py-2 rounded text-sm ">
<UButton size="sm" variant="outline" to="/announcement">
<UIcon name="i-noto-party-popper" />
Expand Down
3 changes: 3 additions & 0 deletions docs/logger.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { createConsola } from 'consola'
import { colorize } from 'consola/utils'

export const logger = createConsola({
defaults: {
tag: 'nuxtseo.com',
},
})

export const gray = (s: string) => colorize('gray', s)
17 changes: 17 additions & 0 deletions docs/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import { existsSync } from 'node:fs'
import { readFile, writeFile } from 'node:fs/promises'
import { gray, logger } from '~~/logger'
import { defineNuxtConfig } from 'nuxt/config'
import { resolve } from 'pathe'
import NuxtSEO from '../src/module'
Expand Down Expand Up @@ -26,6 +29,20 @@ export default defineNuxtConfig({
nitro.options.alias.sharp = 'unenv/runtime/mock/empty'
nitro.options.alias.pnpapi = 'unenv/runtime/mock/empty' // ?
nitro.options.alias['#content/server'] = resolve('./server/content-v2')
nitro.hooks.hook('compiled', async (_nitro) => {
const routesPath = resolve(nitro.options.output.publicDir, '_routes.json')
if (existsSync(routesPath)) {
const routes: { version: number, include: string[], exclude: string[] } = await readFile(routesPath)
.then(buffer => JSON.parse(buffer.toString()))
const preSize = routes.exclude.length
routes.exclude = routes.exclude.filter(path => path.startsWith('/docs') && !path.includes('*'))
routes.exclude = routes.exclude.filter(path => path.startsWith('/learn') && !path.includes('*'))
if (preSize !== routes.exclude.length) {
logger.info(`Optimizing CloudFlare \`_routes.json\` for prerendered OG Images ${gray(`(${100 - Math.round(routes.exclude.length / preSize * 100)}% smaller)`)}`)
}
await writeFile(routesPath, JSON.stringify(routes, void 0, 2))
}
})
})
},
],
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@
},
"dependencies": {
"@nuxt/kit": "^3.13.2",
"@nuxtjs/robots": "^4.1.9",
"@nuxtjs/robots": "^4.1.10",
"@nuxtjs/sitemap": "^6.1.2",
"nuxt-link-checker": "^3.1.2",
"nuxt-link-checker": "^3.1.3",
"nuxt-og-image": "^3.0.4",
"nuxt-schema-org": "^3.4.1",
"nuxt-seo-utils": "^5.0.1",
Expand All @@ -67,7 +67,7 @@
"@vue/test-utils": "^2.4.6",
"bumpp": "^9.7.1",
"eslint": "^9.13.0",
"execa": "^9.4.1",
"execa": "^9.5.1",
"happy-dom": "^15.7.4",
"nitropack": "^2.9.7",
"nuxt": "3.13.2",
Expand Down
Loading

0 comments on commit f7c8bda

Please sign in to comment.