Adding og images to VitePress

329 Views Asked by At

I've seen that in the VitePress .md files you can add meta description and keywords like this,

head:
  - - meta
    - name: description
      content: my custom description

But I can't seem to figure out how to add og:title or og:image, it seems that the : throws an error when compiling.

1

There are 1 best solutions below

0
On

Refer:


So you basically need to do:

head:
  - - meta
    - name: 'og:title'
      content: Foo Bar

Moreover, VitePress supports setting the frontmatter in JSON too. So this should also work:

{ "head": [["meta", { "name": "og:title", "content": "Foo Bar" }]] }