Skip to content

feat: write real meta descriptions and shorten the homepage title - #269

Merged
limonte merged 1 commit into
mainfrom
seo-meta-descriptions
Aug 5, 2026
Merged

feat: write real meta descriptions and shorten the homepage title#269
limonte merged 1 commit into
mainfrom
seo-meta-descriptions

Conversation

@limonte

@limonte limonte commented Aug 5, 2026

Copy link
Copy Markdown
Member

Closes #254 — the remaining, non-mechanical half. (#266 did the Open Graph tags.)

Problem

meta description was a copy of <title>, so recipe pages described themselves in 1–4 words:

<title>Colored Toasts</title>
<meta name="description" content="Colored Toasts" />

Google discards descriptions that thin and writes its own snippet from page text — and there is no page text, since the site is CSR (#253). The homepage had the opposite problem: a 118-character title, truncated at ~60 in results, duplicated verbatim as its description.

Changes

partials/head.htmldescription is now its own param, feeding meta description, og:description and twitter:description.

tools/generate-recipe-html.mjs — a description per recipe. I wrote each from the recipe's actual source rather than from its title, so they name the real technique:

Recipe Description
Colored Toasts Create colored SweetAlert2 toast notifications with Swal.mixin(), iconColor and a timer progress bar.
Draw Attention Make a SweetAlert2 popup shake instead of closing when the backdrop is clicked, using allowOutsideClick and animate.css.
Blurred Backdrop Blur the page behind a SweetAlert2 popup with a CSS filter applied while swal2-shown is active.
Crop User Image Let users crop an image inside a SweetAlert2 popup with Cropper.js, updating a live preview as they drag.

(The full set is in the diff.) Reading the sources changed some of these — the blurred-backdrop recipe uses a plain filter on the page content, not backdrop-filter, which is what I'd have written from the name alone.

Recipe titles get a " - SweetAlert2" suffix, skipped where the title already says SweetAlert2, so there's no "SweetAlert2 + React - SweetAlert2". Breadcrumb names deliberately keep the unsuffixed title.

index.html — title cut 118 → 58 chars; the full tagline moves into the description, where 139 chars fits comfortably.

404.html — its own description.

Verification

Programmatic check across all 23 pages:

  • 0 pages where description still equals title
  • descriptions 66–139 chars — all inside the useful window, none thin
  • titles 19–65 chars — none truncated
  • no unreplaced {=$...} placeholders
  • breadcrumb JSON-LD still carries the unsuffixed name ('Colored Toasts'), confirming the suffix didn't leak into structured data
  • bun run lint and bun run build pass

The one thing to look at

The homepage title change is a judgment call, not a mechanical fix. It goes from:

SweetAlert2 - a beautiful, responsive, customizable and accessible (WAI-ARIA) replacement for JavaScript's popup boxes

to:

SweetAlert2 - beautiful, accessible JavaScript popup boxes

It keeps the brand first and the terms people search for, and stops the tail being cut off mid-phrase. But the homepage title is a ranking-relevant asset, so if you'd rather keep the original wording, that's a one-line revert and the rest of the PR stands on its own.

🤖 Generated with Claude Code

meta description was a copy of <title>, so recipe pages advertised
themselves with 1-4 words ("Colored Toasts"). Google discards
descriptions that thin and writes its own snippet instead.

- head.html: description is its own param, used by meta description,
  og:description and twitter:description
- generate-recipe-html.mjs: a description per recipe, written from what
  each recipe's source actually demonstrates
- recipe <title> gets a " - SweetAlert2" suffix, skipped where the title
  already says SweetAlert2 (no "SweetAlert2 + React - SweetAlert2").
  Breadcrumb names keep the unsuffixed title.
- index.html: title cut from 118 to 58 chars so it stops being truncated
  in results; the full tagline moves to the description, where 139 chars
  fits comfortably
- 404.html: its own description

Every page now has a distinct description of 66-139 chars and a title of
19-65 chars.

Closes #254

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@limonte
limonte merged commit 01cc7d8 into main Aug 5, 2026
1 check passed
@limonte
limonte deleted the seo-meta-descriptions branch August 5, 2026 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SEO: meta/OG tags are wrong or duplicated across all 22 pages (og:url, og:title, http:// image, description = title)

1 participant