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

[BUG]: Dynamic OG image generation in AstroPaper blog posts #423

Open
Henrique-ND opened this issue Dec 3, 2024 · 1 comment
Open

[BUG]: Dynamic OG image generation in AstroPaper blog posts #423

Henrique-ND opened this issue Dec 3, 2024 · 1 comment

Comments

@Henrique-ND
Copy link

Hello, everyone! I'm new to the world of web development programming, and after months of research, I came across Astro Build. I was really impressed by the concept behind the Astro Paper project and its evolution, thanks to the ongoing improvements made by the community.

I'm facing an issue, and although I’ve searched the "Issues" section here, I couldn't find anything that explains what might be happening. The problem is that the dynamic images in my posts are not showing up when I add their paths, as shown in the example below:

title: Title Example
slug: slug-example
author: Autor Example
pubDatetime: 2024-12-01T08:00:00Z
modDatetime:
featured: true
draft: false
ogImage: ../../assets/images-posts/img-teste.png
tags:
description:

A practical example is when I paste the post URL in a WhatsApp chat. The link loads briefly, but the dynamic image doesn't show up.

The "ogImage" only appears if I provide an external URL or if I place an image in the public folder. Do I need to install any dependencies, do these come pre-installed when I download the Astro Paper project by default or if there is anything else I might be getting wrong or If you need a specific image size or have a file type that is supported, .png is not loading.?

The version of my astro paper project is the latest released v4.7.0
Latest on Oct 15.

I would like my second link to be the same as the first, showing the "ogimage".

teste

@Henrique-ND
Copy link
Author

Hello everyone! After many hours of research and trial and error, I finally managed to resolve the bug I was facing. I made a beginner's mistake, but I believe this can be helpful for others who, like me, are just starting out in web development.

First, during my research, I discovered that for the image to appear correctly when shared, the "ogImage" object must have dimensions of at least 1200px in width by 630px in height. In my project, I was using a smaller image.

Another mistake I made was in the frontmatter of the .md file: we can't leave any variables empty. Once I fixed these two issues, the problem was resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant