social-share-previews
Skill0 starsChanged 49 days agoMITView on GitHub
Make Laravel pages show a proper title, description and image when shared on WhatsApp, Facebook, LinkedIn, X, Slack and iMessage, using one Blade component for Open Graph, Twitter card, canonical and meta description tags. Use when link previews show no image or the wrong text, adding og:image or Open Graph tags, or setting page titles and meta descriptions.
In this repository11 other files it gives its agents.
- bot-proof-formsSkill
- image-uploadsSkill
- inertia-admin-tablesSkill
- json-ld-structured-dataSkill
- mpesa-stk-pushSkill
- paypal-checkoutSkill
- pre-push-checksSkill
- secrets-scannerSkill
- seo-crawlabilitySkill
- shared-network-rate-limitsSkill
- wordpress-migrationSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 11
When someone pastes your link into WhatsApp or LinkedIn, the app fetches the page and reads a few <meta> tags.
- Very specific: line 16
Create a default share image: 1200 × 630, JPEG, under 300 KB, at public/images/share/default.jpg, or change config('share.image').
- Distinctive: line 22
Check real previews with the Facebook Sharing Debugger, LinkedIn Post Inspector, and by sending the link to yourself on WhatsApp.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Social share previews (Open Graph and Twitter cards)
When someone pastes your link into WhatsApp or LinkedIn, the app fetches the page and reads a few <meta> tags. Get them wrong and the preview is a bare URL. <x-share-meta /> prints them all correctly, with site-wide fallbacks.
Install
- Copy from
stubs/, dropping.stub:resources/views/components/share-meta.blade.php,config/share.php,tests/Feature/ShareMetaTest.php. - Create a default share image: 1200 × 630, JPEG, under 300 KB, at
public/images/share/default.jpg, or changeconfig('share.image'). Put the logo and name in the middle. Some apps crop the edges into a square. - In the layout
<head>, replace the existing<title>and description tags:<x-share-meta :title="$title ?? null" :description="$description ?? null" :image="$shareImage ?? null" :type="$ogType ?? 'website'" :robots="$robots ?? null" /> - Pass details from each page: a blog post sets its title, excerpt, a JPEG share-size image URL and
type="article". - Check real previews with the Facebook Sharing Debugger, LinkedIn Post Inspector, and by sending the link to yourself on WhatsApp.
Why previews break (and what this component does about it)
- WebP images. WhatsApp and several other apps often show no image for WebP
og:image. Serve a JPEG or PNG share size. Theimage-uploadsskill generates a 1200 × 630share.jpgfor every upload. - Relative URLs.
og:imagemust be absolute, withhttps://in production. Everything here goes throughurl()/asset(), so setAPP_URLcorrectly. A test asserts that every URL is absolute. - Wrong size. 1200 × 630 (1.91:1) works everywhere. Images under 200 × 200 are ignored. The default image also declares its width and height, so the first share renders immediately.
- HTML in descriptions. The description is stripped of tags, squished and cut to 160 characters.
- Caching. WhatsApp and Facebook cache previews for days. After fixing tags, re-scrape in the Facebook Sharing Debugger. For WhatsApp, test with a new URL (for example with
?v=2). - Pages behind login or bot protection can't be previewed: the crawler gets the login page. Keep shareable pages public, and don't block
facebookexternalhit,WhatsApp,LinkedInBotorTwitterbot. - One canonical URL.
og:urland<link rel="canonical">use the same URL, so shares of?utm=variants count towards one page.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

