yaml-front-matter - 将 og 图像添加到 VitePress
问题描述
我已经看到在 VitePress.md
文件中,您可以像这样添加元描述和关键字,
head:
- - meta
- name: description
content: my custom description
但我似乎无法弄清楚如何添加og:title
or og:image
,编译时似乎会:
引发错误。
解决方案
参考:
所以你基本上需要做:
head:
- - meta
- name: 'og:title'
content: Foo Bar
此外,VitePress 也支持在 JSON 中设置 frontmatter。所以这也应该有效:
{ "head": [["meta", { "name": "og:title", "content": "Foo Bar" }]] }
推荐阅读
- javascript - 如何按月对数组进行分组 - javascript
- python - 如何在 Python 中加快 zip 文件的提取速度
- image - 如何显示从 Flutter image_picker 插件获取的图像文件大小?
- yocto - Yocto 中 Beaglebone 的 u-boot 配置
- c# - 即使重新启动程序,如何在 if 语句中分配一个值并永远存储它的值?
- selenium - 如何使用 selenium 在 chrome 远程浏览器中启用“保留日志”
- python - 如何使用熊猫创建概率矩阵
- python - TypeError: unhashable type: 'list' 当我想将一些属性值包含到列表中时
- amazon-web-services - 如何使用 StreamManager 为 Jetson Nano 板配置 AWS SiteWise?
- javascript - React Native UI 无法正确呈现