Nuxt Content
Introduction
Nuxt OG Image integrates with Nuxt Content out of the box, supporting a
You can see a demo of this integration in the Nuxt OG Image & Nuxt Content Playground.
Setup
When
Otherwise, you will need to provide the
export default defineNuxtConfig({
ogImage: {
strictNuxtContentPaths: true
}
})
---
path: /blog/3-months-of-europe
ogImage: true
---
Frontmatter Configuration
The frontmatter key has the same options as
---
ogImage:
component: BlogOgImage
props:
image: /blog/3-months-of-europe.png
readingMins: 5
---
If you'd like to use OG Images from your public folder, you can use the
---
ogImage:
url: /blog/3-months-of-europe.png
Content head
The module works by injecting extra tags within the
To have the OG Image work it needs to render this property, if you're not using document driven then you
will need to use the
<script setup>
const page = await useAsyncData(`docs-${route.path}`, () => queryContent(route.path).findOne())
useContentHead(page)
</script>
<template>
<ContentDoc head />
</template>
Screenshots
If you'd prefer to render just screenshots, you can use the
To have this work in your markdown files, you will need to make the components global.
export default defineNuxtConfig({
ogImage: {
componentOptions: {
global: true,
}
}
})
:OgImageScreenshot
Troubleshooting
If you have issues with your