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

Throw an error if a static image doesn't exist #291

Open
2 tasks done
julien-deramond opened this issue Oct 28, 2023 · 0 comments
Open
2 tasks done

Throw an error if a static image doesn't exist #291

julien-deramond opened this issue Oct 28, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@julien-deramond
Copy link
Member

Prerequisites

Proposal

In HeadSEO.astro, we deduce the URL of the static images (not generated automatically) from the URL:

if (openGraphData.staticImage) {
const imagePath = canonicalURL.pathname.replaceAll(/\//g, '')
canonicalImageSrc = new URL('images/' + (imagePath ? imagePath : 'index') + '.png', Astro.site);

However, we aren't sure that this image really exists.

The idea would be to throw an error when running npm run build to inform the developer that the image is missing.

⚠️ This would be a temporary solution waiting for #290 to be implemented. Because, in that case, this system would be useless.

Motivation and context

Avoid having Astro pages without Open Graph images.

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

No branches or pull requests

1 participant