Skip to content

Site-wide quality pass: performance, SEO, accessibility, and architecture - #23

Merged
HumbleBee14 merged 6 commits into
mainfrom
feature/site-quality
Jul 14, 2026
Merged

Site-wide quality pass: performance, SEO, accessibility, and architecture#23
HumbleBee14 merged 6 commits into
mainfrom
feature/site-quality

Conversation

@HumbleBee14

Copy link
Copy Markdown
Member

What this does

One PR covering the full website review findings — performance, SEO, accessibility, and code architecture. No URLs, content, or visual design changed; search engines see the same pages, only lighter and with cleaner signals.

Performance

  • React removed from every static page — SearchModal and AnalyticsConsent rewritten as vanilla Astro components (same markup/CSS, same behavior). Drops the ~56 KB gzip react-dom chunk site-wide; /about went from ~80 KB to 26 KB.
  • inlineStylesheets: 'auto' — the design-system CSS ships once as a cacheable /_astro/*.css instead of being duplicated into all 100+ HTML files.
  • KaTeX CSS (24 KB) loads only on posts containing math.
  • Font preloads for the three above-the-fold woff2 faces (no more first-paint swap).
  • _headers — immutable caching for hashed assets, cache policy for /og/* + /_pagefind/*, baseline security headers (nosniff, referrer-policy, frame, permissions).

SEO

  • RSS item links no longer carry a trailing slash (now match canonicals).
  • Homepage no longer double-emits Organization/WebSite JSON-LD; the site-wide copy gained discord sameAs + publisher.
  • twitter:image:alt added; homepage <title> tightened under 60 chars.
  • Covers get real alt text + width/height (LCP layout-shift fix).
  • Non-standard Host: removed from robots.txt.

Accessibility

  • Lightbox: images are keyboard-openable (Enter/Space), overlay is a proper role=dialog with focus restore on close.
  • Theme toggle exposes aria-pressed and falls back to prefers-color-scheme when no saved preference.
  • Nav links get aria-current; author-page heading hierarchy fixed (h1 → h2).

Architecture / clean code

  • PostRow.astro — one component replaces the post-row markup previously copy-pasted across 5 pages.
  • lib/posts.tsresolvePostAuthors() + authorNames() replace the author-resolution boilerplate repeated in 7 files (server-only, kept out of client-bundled data.ts).
  • lib/pagefind.ts — shared loader (was duplicated in two components); lib/prefs.ts is now genuinely used by Nav + homepage scripts instead of being dead code triplicated inline.
  • WritePortal slimmed (~680 → ~450 lines): dialogs extracted to write/dialogs/, table/image helpers to write/editor/docUtils.ts, BlockNote cast centralized in one accessor.
  • create-pr.ts: duplicated raw-fetch existence checks replaced by one fileExistsOnMain() helper.
  • formatDate/formatMonth accept Date directly — .toISOString() churn removed at ~11 call sites.
  • Comment sweep: narration/decorative comments removed; genuine WHY comments kept.
  • Global [hidden] { display: none !important } reset so attribute-hidden UI can't be resurrected by component display rules.

Verified

  • npm run verify green: astro check (0 errors), eslint (--max-warnings 0), prettier, 56/56 tests.
  • Full production build: 422 files / 13 MB (well under the 20k-file Pages cap), pagefind indexed 48 pages.
  • Checked in dist/: no react on static pages, stylesheet emitted as cacheable link, zero KaTeX bytes on non-math posts, search-modal markup present with hidden enforced.

Worth testing on the preview

  • Search (⌘K / / / nav button), analytics consent banner, theme toggle, homepage accent cycling — these were rewritten from React to vanilla.
  • A post page: lightbox (mouse + keyboard), code copy, likes, comments.
  • /write portal end-to-end (dialogs were extracted, behavior should be identical).

Performance
- Replace React SearchModal/AnalyticsConsent islands with vanilla Astro
  components — drops react-dom (~56 KB gzip) from every static page
- inlineStylesheets: 'auto' — shared CSS ships once as a cacheable file
  instead of being inlined into all 100+ pages
- Load KaTeX CSS only on posts that contain math
- Preload the three above-the-fold woff2 fonts
- Add _headers: immutable caching for hashed assets, cache policy for
  /og/* and /_pagefind/*, baseline security headers

SEO
- rss.xml: drop trailing slash from item links (match canonicals)
- Remove duplicate Organization/WebSite JSON-LD on the homepage; enrich
  the site-wide copy with discord sameAs + publisher
- Add twitter:image:alt; tighten homepage title under 60 chars
- Cover images get real alt text + dimensions (CLS fix)
- Remove non-standard Host: line from robots.txt

Accessibility
- Lightbox: keyboard-openable images, dialog semantics, focus restore
- Theme toggle: aria-pressed state + prefers-color-scheme fallback
- Nav links: aria-current; author page heading hierarchy fixed

Architecture
- New PostRow.astro replaces blog-row markup duplicated across 5 pages
- New lib/posts.ts (resolvePostAuthors, authorNames) replaces the
  author-resolution boilerplate repeated in 7 files
- lib/prefs.ts now actually used by Nav + homepage accent scripts
- lib/pagefind.ts shared loader (was duplicated in two components)
- WritePortal: dialogs + doc utils extracted, casts centralized
- create-pr.ts: fileExistsOnMain() helper replaces duplicated checks
- formatDate/formatMonth accept Date directly
- Comment cleanup: remove narration/decorative comments, keep WHY notes
- [hidden] display reset so attribute-hidden UI always stays hidden
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 14, 2026

Copy link
Copy Markdown

Deploying mlsystems with  Cloudflare Pages  Cloudflare Pages

Latest commit: 47c794b
Status: ✅  Deploy successful!
Preview URL: https://5b8f95b1.mlsystems.pages.dev
Branch Preview URL: https://feature-site-quality.mlsystems.pages.dev

View logs

@github-actions

Copy link
Copy Markdown

One NewsletterCta component, two placements: compact block above the
footer bottom bar (site-wide) and a card at the end of each article.
Renders nothing until SITE.newsletterUrl is set (e.g. a Google Form),
same graceful pattern as giscus/likes.
Three minimal cards per row (scroll-snap for up to six), title +
author/date only — read time and redundant per-card topic chips dropped.
Copy icon next to "Cite as" copies the citation plus the page URL;
icon flips to a check while copied.
- Newsletter: centered capsule strip above the footer opens an inline
  email dialog; submits to a Google Form in the background (no redirect),
  graceful error when unconfigured or offline; mobile stacks centered
- Citation line on posts gets a copy button (citation + page URL)
- Homepage: topics count removed from hero stats
- ToolGlyph: VRAM-stack icon for gpu-mem-calc (was blank); dead
  cost-calc case removed
- External playground tools fact-checked against the live web; four
  descriptions corrected
@HumbleBee14
HumbleBee14 merged commit 8881693 into main Jul 14, 2026
2 checks passed
@HumbleBee14
HumbleBee14 deleted the feature/site-quality branch July 14, 2026 15:07
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.

1 participant