Skip to content
Draft
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ dist/
.vitepress/dist
.vitepress/cache
.vitepress/.temp
src/public/og

# Serverless directories
.serverless/
Expand Down
16 changes: 8 additions & 8 deletions .vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import {
groupIconMdPlugin,
groupIconVitePlugin
} from 'vitepress-plugin-group-icons'
import { addOgImage } from 'vitepress-plugin-og'
import { withCtx } from 'vue'

const nav: ThemeConfig['nav'] = [
{
Expand Down Expand Up @@ -610,15 +612,7 @@ export default defineConfigWithTheme<ThemeConfig>({
content: 'Vue.js - The Progressive JavaScript Framework'
}
],
[
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a better default once the template is created (especially for pages that won't have a dedicated template

  vitepress v1.6.4

⠋ building client + server bundles...llmstxt »   Plugin initialized (client build)
⠙ building client + server bundles...llmstxt »   Build started, file collection cleared
[vitepress-plugin-og] Cannot generate OG image for page without title: partners/[partnerId].md
[vitepress-plugin-og] Cannot generate OG image for page without title: partners/[partnerId].md
[vitepress-plugin-og] Cannot generate OG image for page without title: partners/[partnerId].md
[vitepress-plugin-og] Cannot generate OG image for page without title: partners/[partnerId].md
[vitepress-plugin-og] Cannot generate OG image for page without title: partners/[partnerId].md
[vitepress-plugin-og] Cannot generate OG image for page without title: partners/[partnerId].md
[vitepress-plugin-og] Cannot generate OG image for page without title: partners/[partnerId].md
⠧ building client + server bundles...llmstxt »   Processing 94 markdown files...

Maybe, there is a solution to generate OG for dynamic pages.

'meta',
{
property: 'og:image',
content: 'https://vuejs.org/images/logo.png'
}
],
['meta', { name: 'twitter:site', content: '@vuejs' }],
['meta', { name: 'twitter:card', content: 'summary' }],
[
'link',
{
Expand Down Expand Up @@ -759,6 +753,12 @@ export default defineConfigWithTheme<ThemeConfig>({
}
},

async transformPageData(pageData, ctx) {
await addOgImage(pageData, ctx, {
domain: 'https://vuejs.org',
})
},

markdown: {
theme: 'github-dark',
config(md) {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"typescript": "^5.6.3",
"vitepress-plugin-group-icons": "^1.5.4",
"vitepress-plugin-llms": "^0.0.8",
"vitepress-plugin-og": "^0.0.3",
"vue-tsc": "^2.1.6"
},
"packageManager": "[email protected]"
Expand Down
Loading