harlan-zw / nuxt-seo

The complete SEO solution for Nuxt.
https://nuxtseo.com
MIT License
1.09k stars 70 forks source link

Setting custom og image does not work with Nuxt Content #349

Open martinszeltins opened 1 week ago

martinszeltins commented 1 week ago

Describe the bug

I wanted to set a custom og image but it is not working, it is still generating an og image but I wanted to provide my own custom one. I can see that the other properties like width, height and alt worked but the image path is wrong.

I tried both paths but neither worked http://localhost:3000/my-og.png or /my-og.png

---
title: "Building Your First API with Express.js: A Beginner's Guide"
description: "A beginner-friendly guide to building your first API with Express.js"
published: 2023/11/2
path: /building-your-first-api-with-expressjs-a-beginners-guide
showOgImage: true
ogImage:
  url: http://localhost:3000/my-og.png
  width: 1200,
  height: 600,
  alt: 'My Image'
---

Result:

<meta property="og:image" content="http://localhost:3000/__og-image__/image/building-your-first-api-with-expressjs-a-beginners-guide/og.png">
<meta property="og:image:width" content="1200,">
<meta property="og:image:height" content="600,">
<meta property="og:image:type" content="image/png">
<meta property="og:image:alt" content="My Image">

The image path should be http://localhost:3000/my-og.png not http://localhost:3000/__og-image__/image/building-your-first-api-with-expressjs-a-beginners-guide/og.png

Screenshot: image

Reproduction

No response

System / Nuxt Info

No response