-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/add twitter og support #14
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughAdded static web metadata and a crawler configuration: Twitter Card meta tags and Google site verification were inserted into the example HTML head, and a new Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@examples/basic/index.html`:
- Around line 22-28: The twitter:image (and corresponding og:image) meta tags
use a relative path (/logo.png) which will fail for Twitter/X and OpenGraph;
update the content attributes for the meta tags named "twitter:image" and
"og:image" to use fully-qualified absolute HTTPS URLs (including protocol and
domain), or wire them to a runtime/template variable that inserts the site's
origin so the meta values are absolute.
| <meta name="twitter:card" content="summary_large_image" /> | ||
| <meta name="twitter:title" content="(main) React Head Safe" /> | ||
| <meta | ||
| name="twitter:description" | ||
| content="(main) A CSR-only React head manager that prevents duplicate meta tags." | ||
| /> | ||
| <meta name="twitter:image" content="/logo.png" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
Twitter Card meta tag image URL requirements absolute vs relative path
💡 Result:
For Twitter/X Cards, the twitter:image value should be a fully-qualified (absolute) URL—i.e., include scheme + host + full path, like:
<meta name="twitter:image" content="https://example.com/images/card.jpg">Relative paths (e.g., /images/card.jpg) commonly fail because Twitterbot can’t reliably resolve them when scraping. [2], [6]
Also avoid protocol-relative URLs (e.g., //example.com/image.jpg); use an explicit https:// URL instead. [8]
X’s card markup docs define twitter:image as a “URL of image to use in the card” and specify key constraints (e.g., supported formats, < 5MB, etc.). [3], [1]
Sources: X Developer Platform docs on Cards markup / Summary Card image constraints [3], [1]; reported behavior in practice that Twitter Cards require absolute (not relative / not protocol-relative) image URLs [2], [8].
🏁 Script executed:
# Check the full context of the HTML file
cd examples/basic && cat -n index.html | head -40Repository: umsungjun/react-head-safe
Length of output: 1612
🏁 Script executed:
# Look for other social meta tags in the file to see URL patterns
cd examples/basic && rg 'meta name.*content' index.html -A 0Repository: umsungjun/react-head-safe
Length of output: 403
Use absolute URLs for twitter:image and og:image.
Twitter/X Cards require fully-qualified absolute URLs for the twitter:image meta tag; relative paths like /logo.png will fail with Twitterbot and prevent card images from displaying. The same applies to og:image for consistency and OpenGraph compliance.
Required changes
- <meta property="og:image" content="/logo.png" />
+ <meta property="og:image" content="https://react-head-safe.vercel.app/logo.png" />
<meta property="og:url" content="https://react-head-safe.vercel.app/" />
<meta property="og:type" content="website" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="(main) React Head Safe" />
<meta
name="twitter:description"
content="(main) A CSR-only React head manager that prevents duplicate meta tags."
/>
- <meta name="twitter:image" content="/logo.png" />
+ <meta name="twitter:image" content="https://react-head-safe.vercel.app/logo.png" />🤖 Prompt for AI Agents
In `@examples/basic/index.html` around lines 22 - 28, The twitter:image (and
corresponding og:image) meta tags use a relative path (/logo.png) which will
fail for Twitter/X and OpenGraph; update the content attributes for the meta
tags named "twitter:image" and "og:image" to use fully-qualified absolute HTTPS
URLs (including protocol and domain), or wire them to a runtime/template
variable that inserts the site's origin so the meta values are absolute.
Summary by CodeRabbit
New Features
Chores