Vue framework
Add automatic MyOG.social images to Nuxt pages with useSeoMeta, route data, and server-rendered head tags.
Nuxt's useSeoMeta composable is the right MyOG integration point because it renders typed Open Graph and Twitter tags into the document head.
Use a shared helper to build the MyOG image URL from the current route, then call useSeoMeta in pages or layouts that already know the canonical URL.
For generated routes, keep the page URL server-rendered. Social crawlers should receive og:image in the initial HTML, not after client-side navigation.
MyOG detects page content and branding automatically. The layout only controls image composition.
Use this in a page or shared SEO composable.
const route = useRoute()
const siteURL = "https://example.com"
function getMyOGImageURL(path: string) {
const pageURL = siteURL + path
return `https://api.myog.social/og?url=${encodeURIComponent(pageURL)}&template=screenshot-right`
}
const myogImageURL = computed(() => getMyOGImageURL(route.path))
useSeoMeta({
ogImage: () => myogImageURL.value,
ogImageWidth: "1200",
ogImageHeight: "630",
twitterCard: "summary_large_image",
twitterImage: () => myogImageURL.value,
})Move siteURL into runtime config in a real app, then keep the helper shared across layouts and pages.
If a module, layout, or CMS integration already sets ogImage, replace that value with MyOG instead of adding a second image tag. Multiple og:image values are allowed, but crawlers often pick the first suitable one.
Use route.path for simple pages and explicit canonical paths for dynamic content. If your content comes from a CMS, build the canonical URL from the slug you publish, not from preview or draft URLs.
Start with the MyOG Open Graph Checker, then refresh social platform caches if needed.
Sign up for free and add generated social images to Nuxt routes.
Already have an account?
cdf733b534ea2f2ed964d150330b323c44837e4f