LessonsHow to fix your website preview when sharing a link

Mini lesson 23 of 30 · Reach people and offer services

Choose the card you want to share

Who is this for?

Website owners whose shared links show a missing or misleading preview. A coding assistant can add the page metadata; you inspect the actual shared card.

The preview is generated from a publicly fetchable page.

Purpose of this lesson

  • Connect the intended title, description and image.
  • Check that the image is publicly fetchable.
  • Inspect the actual platform preview and its limits.
Explanation, worked example and practice

Before you start

Your own public HTTPS practice page and the supplied share-card image. An assistant can edit/publish its files. Social platforms cannot fetch a private localhost page, and their cached previews may need refreshing.

Check your starting skills

These are useful skills, not locked course requirements. If you can already do them, start this lesson; otherwise open the linked preparation. The supplied starter files mean you do not need an existing personal website.

  1. How to publish your website from GitHub

    Connect a practice repository to hosting.

Estimated time: 15–27 min

Estimates for the supplied starter files with prerequisite accounts and tools ready. Setup, deployment queues and delivery/DNS waits take additional time. Platforms cache results and decide what they show. A local metadata check cannot prove a live LinkedIn, Slack or WhatsApp preview.

Understand the idea

Open the supplied page. Its title is “Practical notes for building a website”, and it includes share-card.jpg. Decide whether that title, its short description and the picture accurately describe what a visitor will open.

Give the assistant your real public HTTPS page address and ask it to connect these values for sharing. The reserved https://YOUR-SITE.example/ origin is a template; a platform cannot fetch a picture that exists only on your laptop.

A concrete example

The supplied description is “Small examples, working files and clear checks for your next website feature.” Together with the title, it promises practical website notes rather than an unrelated homepage.

Use the supplied page and share image. Add the intended article-specific title, description and absolute public image URL while keeping visible content consistent. Help check the published page/image signed out, then inspect a real sharing preview. Handle the metadata code. Do not claim a platform update from only a local picture or a provider cache refresh request.

Files for this step

Start hereWorkshop files

Open or download the files below. When saving a project, keep the folder paths shown in the filenames.

Try it yourself

Using the supplied page, what title, description and image should the shared card show, and which page must the card open?

Show a worked solution

The title is “Practical notes for building a website”; the description promises small examples, working files and clear checks; the image is share-card.jpg. The card must open the corresponding published page. The https://YOUR-SITE.example/ values must first be replaced with my real HTTPS site address.

What a sound answer includes

  • Uses a title, description and image consistent with the supplied page.
  • Identifies the actual public page as the target rather than localhost or a template origin.
How it works (optional)

Make a shared link explain its destination

A preview needs page metadata and an image the platform can actually fetch.

A share preview is usually assembled by a platform fetching your URL and reading metadata. It is not simply a screenshot of what your signed-in browser sees.

This lesson supplies a complete page head and a new share image. You will replace the reserved example origin, publish your own practice page and inspect what an unauthenticated request receives.

Worked example

A useful title says what the page offers. “My site” provides much less context than “Practical notes for building a website”, followed by a short description.

Open Graph: basic metadata

Extra implementation exercise

Why can a thumbnail work on your laptop yet fail in Slack?

Show a worked solution

The platform cannot reach localhost or your authenticated session. It also needs a reachable image URL and correct HTML metadata at the exact shared address.

  • Recognizes the platform needs public network access.
  • Checks the shared URL and image independently.

Step 1 · How to fix your website preview when sharing a link

Check the published image

Inspect the image route the card actually references.

Explanation, worked example and practice

Understand the idea

Publish the practice change when ready, then open the actual share-image URL signed out. Have the assistant confirm it is the intended image rather than a missing file or login page.

Changing the visible page picture does not necessarily change the separate image value used for sharing. Verify the delivered reference too.

A concrete example

If the image URL opens the site’s HTML homepage instead of share-card.jpg, the server may still return 200. The URL works as a page, but it does not supply an image for a card.

Files for this step

Start hereWorkshop files

Open or download the files below. When saving a project, keep the folder paths shown in the filenames.

Try it yourself

Your sharing image URL returns 200 but displays an HTML homepage. Is that a successful image check? What needs fixing?

Show a worked solution

No. The card needs an actual image at the configured URL. I would ask the assistant to publish share-card.jpg at that path and verify that a signed-out request returns the picture with image/jpeg content, not the homepage fallback.

What a sound answer includes

  • Rejects an HTML fallback as an image even when the response status is 200.
  • Checks the exact configured public image URL and actual image content.
How it works (optional)

Put the preview in the initial HTML

Use absolute canonical and image URLs that survive an external fetch.

Inspect the supplied head. og:title, og:description, og:type, og:url and og:image describe this exact page. The image path is absolute because a remote crawler needs an unambiguous destination.

Replace YOUR-SITE.example everywhere. The image is a real file included with the workshop. Do not rely on browser JavaScript to insert essential metadata after load; crawler behaviour varies.

The supplied landscape card is 1672 × 941 pixels. Platforms may crop or resize it differently, so keep meaningful details away from the edges and inspect the actual result. It is a starting asset, not a promise that every platform will show the same crop. Confirm share-card.jpg is present in the deployed public folder.

Before trying any platform, open your exact deployed og:image URL signed out and verify a successful image/jpeg response with the actual image visible. A missing file, reserved example origin or HTML fallback fails this check.

Worked example

A correct relative image in the visible body does not repair a broken absolute og:image. Inspect both destinations rather than assuming they are the same.

<meta property="og:image"
  content="https://YOUR-SITE.example/share-card.jpg">
<meta property="og:type" content="website">

Extra implementation exercise

You changed the visible page image but left og:image pointing to a missing file. Which image will a crawler try?

Show a worked solution

It will typically try the metadata image, which is still broken. Correct the og:image URL and verify its actual response.

  • Reads the metadata destination.
  • Does not infer preview data from the rendered body.

Step 2 · How to fix your website preview when sharing a link

Inspect a real platform preview

Keep remote fetching and caching in view.

Explanation, worked example and practice

Understand the idea

After publishing, inspect the page and image URLs signed out. Then use a platform tool such as LinkedIn Post Inspector where available, or share the practice link privately and inspect its real card. Compare the displayed title, description and image crop.

Write down the platform and what it displayed. If the public files are current but the platform still shows an old card, investigate its cache; requesting a refresh is a step, not a visible result.

A concrete example

Illustrative comparison: the public page supplies the new title and JPEG, while the inspected platform still displays an older title. That points to a platform-specific cached result, not proof that every platform has refreshed.

Files for this step

Start hereWorkshop files

Open or download the files below. When saving a project, keep the folder paths shown in the filenames.

Try it yourself

What card did your chosen platform show, and what remains uncertain?

Show a worked solution

Illustrative result: the public page and JPEG are current, but the selected platform still shows the previous title. I would record that platform’s old preview, request a refresh through its available tool and inspect the resulting card again. I would not report an updated WhatsApp card from a LinkedIn-only check.

What a sound answer includes

  • Records the actual card on a named platform and compares its title/image with the page.
  • Distinguishes current public output from a platform’s possibly cached card.
How it works (optional)

Check the response before blaming the cache

Verify raw HTML, redirects and image access, then test the platform.

Open the exact shared URL in a signed-out browser and inspect raw source. Follow redirects and check the final status. Fetch the image separately: it must return image bytes with an appropriate content type rather than an HTML fallback.

After the server output is correct, use a platform's inspection tool where available and try a new share. Existing messages may keep cached previews. Refreshing your own browser cache does not clear a social platform's cache.

For example, open LinkedIn Post Inspector with your own account and enter the exact public URL. Meta Sharing Debugger is another platform-specific tool and may require login. In browser developer tools, select the image request in Network and inspect Headers → Content-Type plus the response preview. Platform tools can still be unavailable or cached.

The target page/image must be accessible to a visitor or crawler without your owner session. The debugging tool is separate: LinkedIn or Meta may require you to sign in to use its inspector. Tool login does not make a private target crawlable. If you lack tool access, record that limitation and keep raw-response checks separate from an unobserved platform preview.

For WhatsApp or Slack, you can share the public practice URL in a test conversation you control and record the preview or its absence. Do not claim a platform passed when you only inspected HTTP responses; if an account or tool is unavailable, record that limit.

Worked example

An image request returning 200 text/html can actually be a single-page app fallback. Status 200 alone does not prove an image was served.

LinkedIn Post Inspector · Meta Sharing Debugger

Extra implementation exercise

The og:image request returns 200 with a login page. Is the image check successful?

Show a worked solution

No. The crawler received HTML rather than the image. Fix routing/access so the image URL returns the actual file without a login.

  • Checks content type/body as well as status.
  • Requires unauthenticated access to actual image bytes.

Step 3 · How to fix your website preview when sharing a link

Finish an article-specific card

Keep the shared identity and actual page aligned.

Explanation, worked example and practice

Understand the idea

Ask the assistant to add the supplied reference article, “Fix a mismatched contact link”, with its own sharing title, description and page URL. It may reuse share-card.jpg; its identity should still describe that article rather than the homepage.

Publish the article to your practice site, open its exact public page and image, and inspect its platform card again. Keep any unavailable platform check in the final note.

A concrete example

The article’s card title should be “Fix a mismatched contact link”. Its description explains comparing href and id, repairing the anchor and checking the result. Reusing the homepage’s broad title would hide what this particular link teaches.

Files for this step

Start hereWorkshop files

Open or download the files below. When saving a project, keep the folder paths shown in the filenames.

Try it yourself

Provide the article link and the actual image/platform check record.

What to produce: The public practice URL and observed image/preview results, including any cache limitations.

Show a worked solution

Illustrative handoff: article.html identifies “Fix a mismatched contact link”, describes the anchor repair and points to the published article URL; share-card.jpg opens signed out. The inspected platform displays that article title. Other platforms remain untested, so I have not claimed their previews refreshed.

What a sound answer includes

  • Gives the article its own matching title, description and public page URL.
  • Provides actual image/platform observations and identifies any platform not checked.
How it works (optional)

Your assignment: preview a specific article

Give a deep link its own accurate title, description and image.

Create an article page with its own metadata and a descriptive share message. Keep its canonical/og:url on that article rather than the homepage.

Publish only to your practice site, test its unauthenticated responses and record one platform's actual preview if available. If the platform refuses or caches an old result, document that observation instead of declaring success from the HTML alone.

Worked example

Two different articles that always preview the homepage are technically shareable but do not help the recipient understand the specific link.

The complete reference walkthrough is available in reference/assignment-walkthrough.txt. Compare its steps with your own result; fill the test record from observations in your own project.

Extra implementation exercise

Produce one article-specific preview and a response/platform test record.

Show a worked solution

Replace the reserved origin in canonical, og:url and og:image. Publish the supplied JPEG alongside the HTML. Open both exact URLs signed out and inspect the Network response: the page should be HTML, the image actual image/jpeg bytes rather than an HTML fallback.

For a specific article, give it its own title, description and canonical/OG URL instead of reusing the homepage identity. The full reference article demonstrates that separate head.

Use LinkedIn Post Inspector or Meta Sharing Debugger where your account has access, then record the actual platform result and test time. A cached old preview is a different observation from incorrect current server output. Local source checks alone cannot prove a live WhatsApp preview.

  • Metadata describes the exact shared article.
  • Raw HTML and image access are verified; platform outcome is recorded honestly.

Was this lesson useful?

Leave a like, or share it with someone who could use it.