- 01A link preview is drawn from tags in the head of your page. An app sends a fetcher, reads the tags, and draws the card.
- 02Many fetchers run no JavaScript. The tags must sit in the HTML your host sends.
- 03A preview breaks in a few known ways: no tags, tags written by a script, a relative image path, or an image that is too heavy.
- 04A card for a page is a briefed change. You name the page and the line it should show.
What a preview reads
You paste a link into a chat, and a card appears. It has a title, a line of text and a picture. Nobody drew it by hand. The app built it from a few tags in the head of your page. Developers call them Open Graph tags.
| Tag | What it sets |
|---|---|
| og:title | The bold first line of the card. |
| og:description | The grey line of text under it. |
| og:image | The picture. It needs a full web address. |
| og:image:width and og:image:height | The picture size. An app can plan the space before it loads the file. |
| og:image:alt | The words for a person who cannot see the picture. |
| og:url | The one address the card stands for. |
| twitter:card | Asks for a large picture on top, not a small one at the side. |
A page with no tags gets a poor card. A page with the wrong tags gets a wrong one. Get the tags right and most of the work is done.
Who fetches it
The app does not open your page like a visitor. It sends a small program, a fetcher. The fetcher downloads the HTML, reads the tags, and then downloads the picture. That is all.
Many fetchers run no JavaScript. So the tags must be in the HTML your host sends. A tag that a script adds later does not exist for the fetcher.
The fetcher must also be allowed in. This site lets every crawler read it, and check:seo fails the build if that changes. See being found for the search side.
Where it goes wrong
Seven faults cause most bad previews:
| Fault | What people see | The fix |
|---|---|---|
| The page has no tags | A bare address, or a guess from the first words on the page. | Add the tags to the head of the page. |
| A script writes the tags | Nothing. A fetcher that runs no JavaScript never sees them. | Put the tags in the HTML the host sends. A static build does this for you. |
| A single-page app | The home card for every link. The SPA deep-link fallback rule sends every inner address the same file. So every page carries the home page's tags. | Build one HTML file per page with its own tags, or write the tags on a server. Either one is a briefed change. |
| A relative image path | No picture. The fetcher has no page address to resolve the path against. | Write the full address, starting with https. |
| The wrong picture shape, or a heavy file | A cropped card, or no picture at all. | Use a 1200 by 630 picture. Keep it under 90 KB. Images. |
| A gated site | Nothing. The fetcher has no password, so the gate refuses it. | Decide if the page must stay private. A private page cannot have a public preview. Keeping a site private. |
| An old preview an app has saved | The old card, after you fixed the tags. | Other apps keep their own copy of a preview. We cannot reach into them and clear it. After you change a card, an old preview can stay until that app fetches the page again. |
No control of how an app draws a preview. We set the tags and ship the image. Each app chooses its own crop, size and layout. We cannot make two apps draw the same preview.
By hosting shape
On a static site, the tags and the picture are made when the site is built. Each page is one file with its own tags. A card for a page is a file in the repository.
A static site cannot draw a new card for each request. The check that matches a URL to a rule runs at the edge. It doesn't run your code. Anything that computes an answer per request needs an instance behind it.
On a dedicated instance, your app can write the tags for each request. It can also draw a picture for each page, such as a post title on a plain background. That is application code. CustomLabs can build it.
This site’s own cards
This site has 107 pages. 91 carry their own card. The other 16 share one house card. Those are mostly the legal pages, some utility pages, and a few content pages. We do not claim a card for every page.
The heaviest card is 49 KB. The ceiling is 90 KB, and check:images enforces it. check:seo reads each page. It fails the build if the picture size differs from the declared size, if the alt text is missing, if the image address is not absolute, or if a card file serves no page. It also recounts the card number printed here.
Asking for a card
A new card is a briefed change. CodeHerder carries it. This is how one change ships:
- You name the page and the line it should show. Write the page address and the title. Add the line of text. Say which picture to use, or ask for a drawn card.
- Briefed as a change. Written up the same way any other change request is. The iteration add-on is what covers it.
- An agent opens the pull request. The change lands as a real pull request against the repository, with the test suite run against it.
- A human reviews and merges. Someone reads the diff before it goes anywhere near production — nothing here is auto-applied blind.
- It ships through the same pipeline. The same pipeline that deploys everything else on your stack ships this too — no separate process to babysit.
- You're told it's done. A note confirming what changed and that it merged, in the same shape as every other note on this site.
CodeHerder is $25/mo on any plan. A static site fits the Static Starter plan at $5/mo. Quote this shape. The form opens with this plan and add-on filled in.
A card drawn for each request needs a dedicated instance, from the Dedicated S plan. Quote that shape.