Posts

Showing posts with the label react

How to Build a Next.js Portfolio (Step by Step, 2026)

Image
  Originally published at https://designtocodes.com on August 11, 2026. How to build a Next.js portfolio (step by step) Build a Next.js portfolio by scaffolding an App Router project, structuring routes for your home and project pages, serving images through next/image, adding SEO with the Metadata API, and deploying to Vercel. Next.js renders fast, server-rendered pages by default, so you fill in your work, and it loads fast and ranks. Here is the full guide, plus templates to start from. The 6 steps Scaffold — run create-next-app and choose the App Router. Structure routes — a home page, a projects list, and a page per project. Optimize images — use next/image with priority on the hero. Add SEO — use the Metadata API for titles, descriptions, and canonicals. Write case studies — problem, approach, result, links. Deploy — push to Vercel for HTTPS, a CDN, and automatic deploys. Which rendering method for which page Page Render method Why Home and project pages Stati...

Is Next.js Good for SEO in 2026? An Honest, Tested Answer

Image
    Originally published at https://designtocodes.com on July 14, 2026. Is Next.js good for SEO in 2026? Yes, Next.js is one of the best frameworks for SEO in 2026. It server-renders complete HTML that search engines and AI crawlers can read, manages metadata, sitemaps and canonicals natively without plugins, and is built around Core Web Vitals. The caveat is that a misconfigured Next.js site can undo these advantages, so it helps only when used correctly. Why Next.js is good for SEO Server-rendered HTML by default with the App Router The Metadata API for per-route titles, descriptions, and canonicals Automatic sitemap and robots generation Core Web Vitals support through next/image, next/font, and Server Components Clean URLs and easy structured data Where Next.js can hurt SEO Overusing client components, which hides content from crawlers Skipping image and font optimization, which lowers Core Web Vitals Choosing client-side rendering for pages that should be s...

How to Add Dark Mode to Any Website (CSS + React, No Library)

Image
  How to add dark mode to a website without a library To add dark mode to a website without a library, define your colors as CSS custom properties, override them under a [data-theme="dark"] selector, toggle that attribute with a few lines of JavaScript, and apply the saved theme before the page paints to avoid a flash. The pattern works in plain HTML, React, or any framework. Step 1: define colors as CSS variables :root{ --bg:#ffffff; --text:#1a1a1a } [data-theme="dark"]{ --bg:#0e1116; --text:#e8ecf3 } body{ background:var(--bg); color:var(--text) } Step 2: add the toggle On click, switch the data-theme attribute on the root element and save the choice to localStorage so it persists between visits. Step 3: prevent the white flash on load Apply the saved theme with a small inline script in the page head, before the stylesheet loads. This sets the correct theme before the first paint, which removes the flash-of-wrong-theme most implementations suffer from. Default ...

Next.js Core Web Vitals: How to Score 100/100 in 2026 (Real Fixes)

Image
  How to score 100 on Core Web Vitals in Next.js To score 100 on Core Web Vitals in a Next.js app, render content on the server, serve images through next/image, load fonts with next/font, defer non-critical JavaScript, and set explicit dimensions on all media. Next.js provides the tools; the score comes from using them deliberately. Here is the checklist. Fix LCP (loading) Your hero image is usually the Largest Contentful Paint element. Use next/image with the priority flag so it preloads, and keep the hero server-rendered so content arrives in the initial HTML. Target: under 2.5 seconds. Fix INP (interactivity) Interaction to Next Paint measures responsiveness and is the metric most sites fail. Reduce client-side JavaScript: keep Server Components as the default, add 'use client' only where needed, and code-split heavy widgets with next/dynamic . Target: under 200 milliseconds. Fix CLS (visual stability) Cumulative Layout Shift comes from elements loading without reserved ...