update opengraph stuff in docs, export resolveSiteDataByRoute

pull/4660/head
Divyansh Singh 5 months ago
parent 0e50456017
commit 4995fb909c

@ -1,4 +1,8 @@
import { defineConfig } from 'vitepress'
import {
defineConfig,
resolveSiteDataByRoute,
type HeadConfig
} from 'vitepress'
import {
groupIconMdPlugin,
groupIconVitePlugin,
@ -6,6 +10,8 @@ import {
} from 'vitepress-plugin-group-icons'
import llmstxt from 'vitepress-plugin-llms'
const prod = !!process.env.NETLIFY
export default defineConfig({
title: 'VitePress',
@ -72,8 +78,6 @@ export default defineConfig({
['link', { rel: 'icon', type: 'image/png', href: '/vitepress-logo-mini.png' }],
['meta', { name: 'theme-color', content: '#5f67ee' }],
['meta', { property: 'og:type', content: 'website' }],
['meta', { property: 'og:locale', content: 'en' }],
['meta', { property: 'og:title', content: 'VitePress | Vite & Vue Powered Static Site Generator' }],
['meta', { property: 'og:site_name', content: 'VitePress' }],
['meta', { property: 'og:image', content: 'https://vitepress.dev/vitepress-og.jpg' }],
['meta', { property: 'og:url', content: 'https://vitepress.dev/' }],
@ -120,11 +124,25 @@ export default defineConfig({
firebase: 'logos:firebase'
}
}),
!!process.env.NETLIFY &&
prod &&
llmstxt({
workDir: 'en',
ignoreFiles: ['index.md']
})
]
}
},
transformPageData: prod
? (pageData, ctx) => {
const site = resolveSiteDataByRoute(
ctx.siteConfig.site,
pageData.relativePath
)
const title = `${pageData.title || site.title} | ${pageData.description || site.description}`
;((pageData.frontmatter.head ??= []) as HeadConfig[]).push(
['meta', { property: 'og:locale', content: site.lang }],
['meta', { property: 'og:title', content: title }]
)
}
: undefined
})

@ -1,9 +1,6 @@
---
layout: home
title: VitePress
titleTemplate: Vite & Vue Powered Static Site Generator
hero:
name: VitePress
text: Vite & Vue Powered Static Site Generator

@ -1,9 +1,6 @@
---
layout: home
title: VitePress
titleTemplate: Generador de Sitios Estáticos desarrollado con Vite y Vue
hero:
name: VitePress
text: Generador de Sitios Estáticos Vite y Vue

@ -1,9 +1,6 @@
---
layout: home
title: ویت‌پرس
titleTemplate: Vite & Vue Powered Static Site Generator
hero:
name: ویت‌پرس
text: سازنده سایت‌های ایستا به کمک Vite و Vue

@ -1,9 +1,6 @@
---
layout: home
title: VitePress
titleTemplate: Vite & Vue 기반 정적 사이트 생성기
hero:
name: VitePress
text: Vite & Vue 기반 정적 사이트 생성기

@ -1,9 +1,6 @@
---
layout: home
title: VitePress
titleTemplate: Gerador de Site Estático desenvolvido com Vite & Vue
hero:
name: VitePress
text: Gerador de Site Estático Vite & Vue

@ -1,9 +1,6 @@
---
layout: home
title: VitePress
titleTemplate: Генератор статических сайтов на основе Vite и Vue
hero:
name: VitePress
text: Генератор статических сайтов на основе Vite и Vue

@ -1,9 +1,6 @@
---
layout: home
title: VitePress
titleTemplate: 由 Vite 和 Vue 驱动的静态站点生成器
hero:
name: VitePress
text: 由 Vite 和 Vue 驱动的静态站点生成器

@ -26,6 +26,7 @@ import {
import type { RawConfigExports, SiteConfig, UserConfig } from './siteConfig'
export { resolvePages } from './plugins/dynamicRoutesPlugin'
export { resolveSiteDataByRoute } from './shared'
export * from './siteConfig'
const debug = _debug('vitepress:config')

@ -123,7 +123,7 @@ export function resolveSiteDataByRoute(
head: mergeHead(
siteData.head ?? [],
localeConfig.head ?? [],
...additionalConfigs.map((data) => data?.head ?? []).reverse()
...additionalConfigs.map((data) => data.head ?? []).reverse()
)
} as SiteData
@ -317,6 +317,7 @@ export function stackView<T extends ObjectType>(..._layers: Partial<T>[]): T {
const allKeysArray = [...allKeys]
return new Proxy({} as T, {
// TODO: optimize for performance, this is a hot path
get(_, prop) {
if (prop === UnpackStackView) return layers
return stackView(

Loading…
Cancel
Save