Skip to content

Add default social preview (og:image) to the site - #1203

Open
astra-intelligence wants to merge 1 commit into
github:mainfrom
astra-intelligence:add-og-social-preview
Open

astra-intelligence wants to merge 1 commit into
github:mainfrom
astra-intelligence:add-og-social-preview

Conversation

@astra-intelligence

Copy link
Copy Markdown

This PR adds a default social preview image (og:image) to the GitHub Training Kit site. Currently the site emits zero og:image and zero twitter:card tags, so every link share on Twitter/X, LinkedIn, Slack, Discord, etc. renders as a blank card with no image.

Root cause: in _includes/seo.html, the entire twitter:* block was gated on site.twitter.username (which is unset in _config.yml), and the site.og_image fallback for og:image lived inside that block — so with no twitter.username configured, neither the Twitter card nor the Open Graph image was ever emitted.

What's included:

  • _includes/seo.html — emit twitter:card / twitter:image regardless of site.twitter.username (twitter:site / twitter:creator stay username-gated); emit og:image from site.og_image regardless of site.twitter.username
  • images/og-image.png — a clean 1200×630 default social preview card (GitHub brand colors, "GitHub Training Kit" title, section pills for Git Cheat Sheets / Git Guides / SVN Migration / Submodules vs Subtrees, training.github.com domain chip)
  • _config.yml — set og_image: og-image.png so the default card is used site-wide

After this, sharing any training-kit page shows a proper preview card instead of a blank link.

The site emitted zero og:image and zero twitter:card tags because the
twitter block was gated on site.twitter.username (unset) and the
site.og_image fallback lived inside that block. Every share of the
training kit rendered a blank link preview.

- Emit twitter:card/twitter:image regardless of site.twitter.username
  (site/creator stay username-gated)
- Emit og:image from site.og_image regardless of site.twitter.username
- Add default 1200x630 og-image.png and set og_image in _config.yml

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

1 participant