Skip to content

Add default Open Graph and Twitter preview image #26

@AbdalrahmanWael

Description

@AbdalrahmanWael

Summary

When the website link is shared in places like Discord, X/Twitter, WhatsApp, or Slack, the preview should include a proper social card image instead of falling back to a text-only embed or inconsistent preview.

Current behavior

The base layout already sets og:title, og:description, og:type, og:url, and twitter:card, but og:image is only rendered when a page provides a thumbnail. This means pages without a thumbnail can be shared without a preview image.

Relevant code:

  • src/_includes/layouts/base.njk

Proposed change

  • Add a default site-wide social preview image for pages that do not define thumbnail
  • Also emit matching Twitter image metadata (twitter:image)
  • Ensure the image uses an absolute URL and recommended dimensions for large previews
  • Allow blog posts to override the default image with their own thumbnail

Acceptance criteria

  • Sharing the homepage shows a large preview card with image
  • Sharing any blog post without a thumbnail still shows a default image
  • Sharing a blog post with a thumbnail uses that image instead of the default
  • Discord/X/Twitter preview validators pick up the image correctly

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions