Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

help: Nuxt Generate gives blank og-images on Nuxt Content pages #270

Open
robmontesinos opened this issue Oct 20, 2024 · 0 comments
Open
Labels
help wanted Extra attention is needed

Comments

@robmontesinos
Copy link

📚 What are you trying to do?

I don't know how to create og-images with static nuxt content pages.
Screenshot shows folders with blank image file in all static html pages.
On the dynamic pages using server/api endpoints, the images are either blank or incomplete, in other words, inaccurate thereby irrelevant for SEO purposes, but they show up perfectly on the DevTools Preview.

Image

🔍 What have you tried?

Been working on this all week, made a bunch of changes using Nuxt UI Pro where the code below is the latest version for the markdown pages:

import { NuxtImg } from '#components'

const { data: page } = await useAsyncData('about', () => queryContent('/about').findOne())
if (!page.value) {
  throw createError({ statusCode: 404, message: 'Page not found', fatal: true })
}

const doc = page.value

useSeoMeta({
  title: doc?.title,
  ogTitle: doc?.title,
  description: doc?.description,
  ogDescription: doc?.description
})

defineOgImageComponent('WebPage', {
  title: doc?.title,
  description: doc?.description,
  renderer: 'chromium'
})

definePageMeta({
  documentDriven: true
})

// inherited attrs can mess up the satori parser
defineOptions({
  inheritAttrs: false
})

const headline = computed(() => findPageHeadline(doc))
</script>

<template>
  <UContainer>
    <UPage v-if="page">
      <UPageHeader
        :title="page.title"
        :links="page.links"
        :headline="headline"
      />

      <UPageBody prose>
        <ContentRenderer
          v-if="page.body"
          :value="page"
          :components="{ NuxtImg }"
        />
      </UPageBody>
    </UPage>
  </UContainer>
</template>

ℹ️ Additional context

I'm looking for a way to manually use the same technique that the DevTools preview uses to generate each image one at a time and save them to the .output/public folder, or to configure this module correctly so that it creates the og-images in the correct path as specified by the Vue component. I'd appreciate any advice to solve this problem. Thank you and have a great weekend.

@robmontesinos robmontesinos added the help wanted Extra attention is needed label Oct 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant