Skip to content

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

@julien-deramond

Description

@julien-deramond

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions