βββ README.md /README.md: -------------------------------------------------------------------------------- 1 |
|
23 |
24 | 27 | Premium Courses & Live Sessions 28 | |
29 |
30 |
31 | 34 | Largest Vibe Coding Community 35 | |
36 |
416 | ```
417 |
418 | **Best Practices:**
419 | - β
Serve responsive sources via `srcset`/`sizes`
420 | - β
Prefer **AVIF / WebP** fallbacks
421 | - β
**Preload the hero image** and/or use `fetchpriority="high"`
422 | - β
Lazy-load **below-the-fold** images (`loading="lazy"`)
423 | - β **Not** the LCP image
424 |
425 | ### π€ **Fonts**
426 |
427 | ```html
428 |
429 |
440 | ```
441 |
442 | **Best Practices:**
443 | - β
Self-host WOFF2, subset fonts
444 | - β
Use `font-display: optional` + ``
445 | - β
Avoid FOIT/FOUT and CLS
446 |
447 | ### π **Measure in the Field (RUM)**
448 |
449 | ```ts
450 | // src/metrics/web-vitals.ts
451 | import { onLCP, onCLS, onINP, type Metric } from 'web-vitals';
452 |
453 | const send = (m: Metric) =>
454 | navigator.sendBeacon('/vitals', JSON.stringify({
455 | name: m.name,
456 | value: m.value,
457 | id: m.id,
458 | path: location.pathname
459 | }));
460 |
461 | onLCP(send);
462 | onCLS(send);
463 | onINP(send);
464 | ```
465 |
466 | > π **Google recommends** collecting Web Vitals in the field; the `web-vitals` library is the easiest way to do that.
467 |
468 | ---
469 |
470 | ## π Internationalization
471 |
472 | ### πΊοΈ **Multi-Language Setup**
473 |
474 | - β
Use **separate URLs per language/region** (e.g., `/en/`, `/fr/`)
475 | - β
Add **`hreflang`** cross-links between alternates
476 | - β
Include a **self-reference** on each page
477 | - β Don't rely on `lang` alone
478 |
479 | ---
480 |
481 | ## π± Social Sharing Previews
482 |
483 | ### π¨ **Open Graph & Twitter Cards**
484 |
485 | Add page-specific `og:title`, `og:description`, `og:image` for high CTR, and Twitter card meta. Use the Open Graph protocol as the baseline. (The `SEO` component above handles this.)
486 |
487 | ---
488 |
489 | ## π Deployment & Headers
490 |
491 | ### π§ **Clean Signals**
492 |
493 | - **Redirects**: Permanent site-wide 301 from non-canonical host to canonical, HTTPβHTTPS, trailing slash policy
494 | - **Caching**:
495 | - Hashed static assets β `Cache-Control: public, max-age=31536000, immutable`
496 | - HTML β `no-store` or `max-age=0, must-revalidate`
497 | - **Security**: HSTS (helps consistency on HTTPS)
498 | - **Favicons & Site Names**: Follow Google's favicon and site-name guidelines
499 |
500 | ---
501 |
502 | ## π§ CI/CD SEO Guardrails
503 |
504 | ### π‘οΈ **Prevent SEO Regression**
505 |
506 | - β
**Lighthouse CI** budget in CI (fail builds if LCP/CLS/INP regress)
507 | - β
**ESLint** with `jsx-a11y` plugin (accessibility helps semantics)
508 | - β
**Link checker** (broken internal links)
509 | - β
**Tests** that read route configs and assert each public page has title/description/canonical and JSON-LD
510 |
511 | ---
512 |
513 | ## π Quick Start Checklist
514 |
515 | ### π **Day 1 Implementation**
516 |
517 | - [ ] Pick rendering path: SSR/SSG if possible; otherwise pre-render public routes
518 | - [ ] Implement the `SEO` component + `handle.seo` per route
519 | - [ ] Add Organization (and LocalBusiness/Product/etc.) JSON-LD to relevant pages
520 | - [ ] Ship `sitemap.xml`, `robots.txt` (with sitemap directive), and correct status codes/404s
521 | - [ ] Optimize LCP (hero image preload), fonts, and reduce JS
522 | - [ ] Start collecting Web Vitals with `web-vitals`
523 | - [ ] If multilingual, wire `hreflang`
524 |
525 | ---
526 |
527 | ## β οΈ Common Pitfalls & Solutions
528 |
529 | ### π¨ **Avoid These Mistakes**
530 |
531 | - β **SPA 404s returning HTTP 200** due to "catch-all" rewrites
532 | - β
Configure your host to serve real `404.html` with status 404
533 |
534 | - β **Faceted URLs exploding crawl**
535 | - β
Keep pages crawlable for users but **noindex** values you don't want in the index
536 |
537 | - β **Dynamic rendering** for bots only
538 | - β
Use SSR/SSG or pre-render for everyone instead
539 |
540 | ---
541 |
542 | ## π’ CMS Integration Strategies
543 |
544 | ### A. π― **WordPress (Root) + React App (Subdomain)**
545 |
546 | **What:** Keep all public, indexable content on WordPress at `example.com`. Put the authenticated product at `app.example.com`.
547 |
548 | **Why it works for SEO:**
549 | - WordPress gives non-devs fast publishing + mature SEO plugins
550 | - Google treats **subdomains as valid site partitions**
551 | - You can **noindex** app/login/etc. using `meta robots` or `X-Robots-Tag` header
552 |
553 | ### B. π **Same Domain, Different Origins: Reverse Proxy**
554 |
555 | **What:** Keep marketing at `example.com` and mount the React app at `example.com/app` via **reverse proxy/rewrites**.
556 |
557 | **Why:** Preserves one hostname and **consolidates signals** under the root.
558 |
559 | ### C. π **Headless WordPress + React Front End**
560 |
561 | **What:** WordPress only for content editing/API; public site is built with a React framework that **pre-renders** pages.
562 |
563 | **Benefits:** HTML is ready on first byte (great for crawl & Core Web Vitals) + you retain WordPress editorial workflow.
564 |
565 | ---
566 |
567 | ## π οΈ Framework Recommendations
568 |
569 | ### π **SEO-Forward React Frameworks**
570 |
571 | | Framework | Why it's Strong for SEO | Signature Features |
572 | |-----------|------------------------|-------------------|
573 | | **Next.js (App Router)** | SSR/SSG by default, Server Components + streaming ship HTML early | `generateMetadata`, file-based robots/sitemap, ISR |
574 | | **React Router v7** | SSR + pre-rendering for static URLs, progressive enhancement | Route-level `` + prerender config |
575 | | **TanStack Start** | Full-document SSR, streaming, Selective SSR per route | Per-route `ssr` controls, streaming SSR |
576 | | **Astro (with React)** | Islands architecture β static HTML by default, hydrate only interactive components | React integration, islands (`client:*` directives) |
577 | | **Gatsby** | Mature SSG with DSG + optional SSR, huge source plugin ecosystem | DSG/SSR rendering options, CMS integrations |
578 |
579 | ### π― **Choosing the Right Path**
580 |
581 | - **Strong editorial + blogs/docs?** β **Astro** or **Headless WP + Next/Gatsby**
582 | - **One React codebase for everything?** β **Next.js App Router**
583 | - **Prefer edge runtime + progressive enhancement?** β **React Router (v7)** or **Next on Edge**
584 | - **Want to dial SSR per route?** β **TanStack Start**
585 | - **E-commerce on Shopify?** β **Hydrogen**
586 |
587 | ---
588 |
589 | ## π Additional Resources
590 |
591 | ### π **Key Google Documentation**
592 |
593 | - [JavaScript SEO Basics](https://developers.google.com/search/docs/crawling-indexing/javascript/javascript-seo-basics) - Google's official JS SEO guidance
594 | - [Dynamic Rendering as a Workaround](https://developers.google.com/search/docs/crawling-indexing/javascript/dynamic-rendering) - Why to prefer SSR/static
595 | - [Pagination Best Practices](https://developers.google.com/search/docs/specialty/ecommerce/pagination-and-incremental-page-loading) - Crawlable links, unique URLs
596 | - [Robots Meta Tag](https://developers.google.com/search/docs/crawling-indexing/robots-meta-tag) - Control indexing properly
597 | - [Sitemaps Guide](https://developers.google.com/search/docs/crawling-indexing/sitemaps/build-sitemap) - Build and submit sitemaps
598 |
599 | ### π **Performance Resources**
600 |
601 | - [INP Became a Core Web Vital](https://web.dev/blog/inp-cwv-march-12) - March 12, 2024 update
602 | - [Optimize LCP](https://web.dev/articles/optimize-lcp) - Preload critical images
603 | - [Optimize Web Fonts](https://web.dev/learn/performance/optimize-web-fonts) - Preload + font-display: optional
604 | - [Measure Web Vitals](https://web.dev/articles/vitals-field-measurement-best-practices) - Field measurement best practices
605 |
606 | ### ποΈ **Technical Implementation**
607 |
608 | - [Open Graph Protocol](https://ogp.me/) - Social preview reference
609 | - [Structured Data Guidelines](https://developers.google.com/search/docs/appearance/structured-data/sd-policies) - JSON-LD best practices
610 | - [React Helmet Async](https://github.com/staylor/react-helmet-async) - SSR-safe head management
611 |
612 | ---
613 |
614 |