Repository navigation
Add Open Graph social preview tags to all pages - #918
Open
astra-intelligence wants to merge 3 commits into
Open
astra-intelligence wants to merge 3 commits into
astra-intelligence wants to merge 3 commits into
Conversation
numpy.org rendered a blank link card on LinkedIn, Facebook, Slack, WhatsApp, and other platforms that read og:* meta tags. The site only emitted twitter:* tags (from the theme's internal template), so every numpy.org URL shared off-X had no title, description, or image. Add the missing Open Graph tags to the site's custom head partial: site_name, type, per-page title, description (same fallback chain as the theme's meta.html), canonical URL, and the existing 1200x-scale social image (https://numpy.org/images/numpy-image.jpg) with dimensions and alt. Verified with a local Hugo 0.158.0 + Dart Sass 1.93.2 build (the exact pins from netlify.toml): all 9 og tags render on the home page, subpages get per-page og:title/og:url, language variants (e.g. /pt/) keep their locale path, and the existing twitter:* tags and jQuery include are unchanged.
✅ Deploy Preview for numpy-org ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
The checklinks build plugin treats og:url as a canonical relation and follows it to the live site during deploy-preview builds, adding a fragment check on https://numpy.org/pt/about/ that fails and breaks the deploy. Social scrapers fall back to the page URL, so the card still renders fully via og:title/og:description/og:image/og:site_name. Co-Authored-By: Paperclip <noreply@paperclip.ing>
Author
|
Note on the earlier failed deploy previews: the first two builds of this PR failed in the Netlify checklinks build-plugin stage. Root cause: the og:url meta tag is treated as a canonical relation by the checklinks plugin, which follows it to numpy.org during deploy-preview builds and adds a fragment check that fails, breaking the deploy. Dropped og:url (social scrapers fall back to the page URL, so the card still renders via og:title/og:description/og:image/og:site_name). Deploy preview is now green — please re-check at your convenience. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
numpy.org currently emits twitter:* meta tags (from the theme internal template) but zero Open Graph (og:) tags. Every numpy.org URL shared on LinkedIn, Facebook, Slack, WhatsApp, Signal, or any platform that reads og:* renders as a bare text link with no title card, no description, no image — only X/Twitter embeds work today.
Fix
Add the missing Open Graph tags to the site custom head partial (layouts/partials/head.html), which the theme renders on every page:
1 file changed, 8 insertions. No new assets — the existing social card is reused so the Open Graph preview matches the Twitter card exactly. (og:url intentionally omitted: the checklinks deploy plugin follows it to the live site during deploy-preview builds and fails; scrapers fall back to the page URL.)
Verification
Built locally with the exact versions pinned in netlify.toml (Hugo 0.158.0 extended + Dart Sass 1.93.2, make prepare && hugo) and confirmed in the generated HTML: