docs: add seo plugins
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { config } from 'dotenv'
|
||||
import { resolve } from 'path'
|
||||
import { config } from 'dotenv'
|
||||
import { defineUserConfig } from 'vuepress'
|
||||
import type { HeadConfig } from 'vuepress'
|
||||
import { docsearchPlugin } from '@vuepress/plugin-docsearch'
|
||||
@@ -9,8 +9,10 @@ import Icons from 'unplugin-icons/vite'
|
||||
import IconsResolver from 'unplugin-icons/resolver'
|
||||
import Components from 'unplugin-vue-components/vite'
|
||||
import AutoImport from 'unplugin-auto-import/vite'
|
||||
import seoPlugin from 'vuepress-plugin-seo2'
|
||||
import sitemapPlugin from 'vuepress-plugin-sitemap2'
|
||||
import { copyVueFlowPlugin } from './copy-plugin'
|
||||
import head from './head'
|
||||
import head, { meta } from './head'
|
||||
import Theme from './theme'
|
||||
|
||||
config({ path: resolve(__dirname, '.env') })
|
||||
@@ -51,7 +53,7 @@ export default defineUserConfig({
|
||||
compiler: 'vue3',
|
||||
}),
|
||||
],
|
||||
}
|
||||
},
|
||||
}),
|
||||
|
||||
plugins: [
|
||||
@@ -60,7 +62,14 @@ export default defineUserConfig({
|
||||
appId: 'F7BJNSM4M5',
|
||||
apiKey: process.env.ALGOLIA_API_KEY!,
|
||||
indexName: 'vueflow',
|
||||
})
|
||||
}),
|
||||
seoPlugin({
|
||||
hostname: meta.url,
|
||||
author: 'Burak Cakmakoglu',
|
||||
}),
|
||||
sitemapPlugin({
|
||||
hostname: meta.url,
|
||||
}),
|
||||
],
|
||||
],
|
||||
|
||||
|
||||
@@ -1,20 +1,14 @@
|
||||
import { Plugin } from 'vite'
|
||||
import { existsSync, readFileSync } from 'fs'
|
||||
import { resolve } from 'path'
|
||||
import type { Plugin } from 'vite'
|
||||
|
||||
export function copyVueFlowPlugin(): Plugin {
|
||||
return {
|
||||
name: 'copy-vue-flow',
|
||||
generateBundle() {
|
||||
const filePath = resolve(
|
||||
__dirname,
|
||||
'../../node_modules/@braks/vue-flow/dist/vue-flow.es.js'
|
||||
)
|
||||
const filePath = resolve(__dirname, '../../node_modules/@braks/vue-flow/dist/vue-flow.es.js')
|
||||
if (!existsSync(filePath)) {
|
||||
throw new Error(
|
||||
`@braks/vue-flow/dist/vue-flow.es.js not built. ` +
|
||||
`Run "pnpm -w build" first.`
|
||||
)
|
||||
throw new Error(`@braks/vue-flow/dist/vue-flow.es.js not built. ` + `Run "pnpm -w build" first.`)
|
||||
}
|
||||
|
||||
this.emitFile({
|
||||
@@ -22,6 +16,6 @@ export function copyVueFlowPlugin(): Plugin {
|
||||
fileName: 'vue-flow.es.js',
|
||||
source: readFileSync(filePath, 'utf-8'),
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import { resolve } from 'path'
|
||||
import { defaultTheme, SidebarConfigArray, Theme } from 'vuepress'
|
||||
import { readdirSync, statSync } from 'fs'
|
||||
import type { SidebarConfigArray, Theme } from 'vuepress'
|
||||
import { defaultTheme } from 'vuepress'
|
||||
import { path } from '@vuepress/utils'
|
||||
import { useVueFlow } from '@braks/vue-flow'
|
||||
import { readdirSync, statSync } from 'fs'
|
||||
|
||||
const { vueFlowVersion } = useVueFlow()
|
||||
|
||||
function capitalize(str: string) {
|
||||
return str.charAt(0).toUpperCase() + str.slice(1);
|
||||
return str.charAt(0).toUpperCase() + str.slice(1)
|
||||
}
|
||||
|
||||
const typedocSidebarEntries = (): SidebarConfigArray => {
|
||||
@@ -16,7 +17,7 @@ const typedocSidebarEntries = (): SidebarConfigArray => {
|
||||
const docsModules = readdirSync(filePath).filter((name) => statSync(`${filePath}/${name}`).isDirectory())
|
||||
|
||||
const sidebarItems = docsModules.map((module) => {
|
||||
let children = readdirSync(`${filePath}/${module}/`).map(entry => `/typedocs/${module}/${entry}`)
|
||||
let children = readdirSync(`${filePath}/${module}/`).map((entry) => `/typedocs/${module}/${entry}`)
|
||||
|
||||
if (module === 'variables') {
|
||||
children = children.filter((child) => {
|
||||
@@ -31,10 +32,8 @@ const typedocSidebarEntries = (): SidebarConfigArray => {
|
||||
{
|
||||
text: 'Modules',
|
||||
link: '/typedocs/',
|
||||
children: [
|
||||
...sidebarItems,
|
||||
],
|
||||
}
|
||||
children: [...sidebarItems],
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
@@ -45,7 +44,8 @@ export default {
|
||||
docsBranch: 'master',
|
||||
lastUpdated: true,
|
||||
contributors: true,
|
||||
darkMode: true,
|
||||
colorMode: 'auto',
|
||||
colorModeSwitch: true,
|
||||
logo: '/favicons/android-chrome-512x512.png',
|
||||
sidebar: {
|
||||
'/guide/': [
|
||||
@@ -70,9 +70,9 @@ export default {
|
||||
},
|
||||
{
|
||||
text: 'Events',
|
||||
link: '/typedocs/interfaces/FlowEvents.html'
|
||||
link: '/typedocs/interfaces/FlowEvents.html',
|
||||
},
|
||||
'/guide/vue-flow/slots'
|
||||
'/guide/vue-flow/slots',
|
||||
],
|
||||
},
|
||||
'/guide/node',
|
||||
@@ -80,11 +80,7 @@ export default {
|
||||
'/guide/composables',
|
||||
{
|
||||
text: 'Utilities',
|
||||
children: [
|
||||
'/guide/utils/graph',
|
||||
'/guide/utils/instance',
|
||||
'/guide/utils/edge',
|
||||
]
|
||||
children: ['/guide/utils/graph', '/guide/utils/instance', '/guide/utils/edge'],
|
||||
},
|
||||
{
|
||||
text: 'Components',
|
||||
@@ -106,11 +102,7 @@ export default {
|
||||
'/examples/',
|
||||
{
|
||||
text: 'Nodes',
|
||||
children: [
|
||||
'/examples/nodes/',
|
||||
'/examples/nodes/update-node',
|
||||
'/examples/nodes/nesting',
|
||||
]
|
||||
children: ['/examples/nodes/', '/examples/nodes/update-node', '/examples/nodes/nesting'],
|
||||
},
|
||||
{
|
||||
text: 'Edges',
|
||||
@@ -119,7 +111,7 @@ export default {
|
||||
'/examples/edges/updatable-edge',
|
||||
'/examples/edges/connection-line',
|
||||
'/examples/edges/validation',
|
||||
]
|
||||
],
|
||||
},
|
||||
'/examples/save',
|
||||
'/examples/dnd',
|
||||
|
||||
Reference in New Issue
Block a user