惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Project Zero
Project Zero
Webroot Blog
Webroot Blog
Google DeepMind News
Google DeepMind News
T
Troy Hunt's Blog
N
News and Events Feed by Topic
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Forbes - Security
Forbes - Security
Attack and Defense Labs
Attack and Defense Labs
S
Security @ Cisco Blogs
W
WeLiveSecurity
Recent Commits to openclaw:main
Recent Commits to openclaw:main
L
LangChain Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
Security Affairs
O
OpenAI News
酷 壳 – CoolShell
酷 壳 – CoolShell
PCI Perspectives
PCI Perspectives
Y
Y Combinator Blog
H
Heimdal Security Blog
P
Privacy International News Feed
Know Your Adversary
Know Your Adversary
T
Tenable Blog
宝玉的分享
宝玉的分享
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
D
Darknet – Hacking Tools, Hacker News & Cyber Security
腾讯CDC
IT之家
IT之家
The Last Watchdog
The Last Watchdog
Jina AI
Jina AI
V
V2EX
www.infosecurity-magazine.com
www.infosecurity-magazine.com
The Cloudflare Blog
K
Kaspersky official blog
罗磊的独立博客
Help Net Security
Help Net Security
博客园_首页
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
P
Privacy & Cybersecurity Law Blog
Simon Willison's Weblog
Simon Willison's Weblog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
Visual Studio Blog
Hacker News: Ask HN
Hacker News: Ask HN
NISL@THU
NISL@THU
C
CERT Recently Published Vulnerability Notes
云风的 BLOG
云风的 BLOG
博客园 - 三生石上(FineUI控件)
Google DeepMind News
Google DeepMind News
Martin Fowler
Martin Fowler
Scott Helme
Scott Helme
阮一峰的网络日志
阮一峰的网络日志

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
Next.js SEO Meta Tags: The Mistakes That Cost Me 3 Weeks of Traffic
Mitu Das · 2026-05-20 · via DEV Community

I launched a Next.js project, waited three weeks for Google traffic, and got nothing. Not "slow growth" nothing completely invisible nothing. The Search Console showed Googlebot visiting but not indexing. The culprit? I had metadata in the wrong place, and my <title> tag was rendering client-side, after Googlebot had already moved on.

If you're building with Next.js (App Router or Pages Router), this article will walk you through setting meta tags correctly including dynamic tags per page, Open Graph for social sharing, and canonical URLs. No fluff, just working code.

Why Next.js Meta Tags Break More Than You'd Expect

The core problem is rendering timing. In a traditional React SPA, everything renders in the browser which means Googlebot often crawls your page before JavaScript runs, sees a blank <head>, and either defers indexing or skips it.

Next.js solves this with server-side rendering, but only if you use the right APIs. A lot of developers (myself included, initially) reach for react-helmet or manually insert <head> tags in components. That works on the client but not reliably during SSR.

The rule: Always use Next.js's built-in metadata system. In the App Router, that's the metadata export or generateMetadata. In the Pages Router, it's next/head.

App Router: Static and Dynamic Metadata

Static metadata (layout or page level)

For pages where the title and description don't change, export a metadata object:

// app/about/page.tsx
import type { Metadata } from 'next'

export const metadata: Metadata = {
  title: 'About Us  Acme Corp',
  description: 'Learn about the team behind Acme Corp and our mission.',
  openGraph: {
    title: 'About Us  Acme Corp',
    description: 'Learn about the team behind Acme Corp and our mission.',
    url: 'https://acmecorp.com/about',
    siteName: 'Acme Corp',
    type: 'website',
  },
  twitter: {
    card: 'summary_large_image',
    title: 'About Us  Acme Corp',
    description: 'Learn about the team behind Acme Corp and our mission.',
  },
  alternates: {
    canonical: 'https://acmecorp.com/about',
  },
}

export default function AboutPage() {
  return <main>...</main>
}

Enter fullscreen mode Exit fullscreen mode

This gets rendered server-side. Googlebot sees it immediately, no JavaScript required.

Dynamic metadata (for blog posts, product pages, etc.)

When titles and descriptions come from a database or CMS, use generateMetadata:

// app/blog/[slug]/page.tsx
import type { Metadata } from 'next'

type Props = {
  params: { slug: string }
}

export async function generateMetadata({ params }: Props): Promise<Metadata> {
  const post = await fetchPost(params.slug) // your data-fetching function

  return {
    title: `${post.title}  My Blog`,
    description: post.excerpt,
    openGraph: {
      title: post.title,
      description: post.excerpt,
      url: `https://myblog.com/blog/${params.slug}`,
      type: 'article',
      publishedTime: post.publishedAt,
      images: [
        {
          url: post.coverImage,
          width: 1200,
          height: 630,
          alt: post.title,
        },
      ],
    },
    alternates: {
      canonical: `https://myblog.com/blog/${params.slug}`,
    },
  }
}

Enter fullscreen mode Exit fullscreen mode

Next.js calls generateMetadata on the server before rendering. The fetched data is automatically deduped with any matching fetch calls in the page component itself you won't hit your API twice.

Pages Router: Using next/head

If you're on the Pages Router, the equivalent is importing Head from next/head:

// pages/blog/[slug].tsx
import Head from 'next/head'
import { GetServerSideProps } from 'next'

type Post = {
  title: string
  excerpt: string
  slug: string
  coverImage: string
}

export default function BlogPost({ post }: { post: Post }) {
  const url = `https://myblog.com/blog/${post.slug}`

  return (
    <>
      <Head>
        <title>{post.title}  My Blog</title>
        <meta name="description" content={post.excerpt} />
        <link rel="canonical" href={url} />
        <meta property="og:title" content={post.title} />
        <meta property="og:description" content={post.excerpt} />
        <meta property="og:url" content={url} />
        <meta property="og:type" content="article" />
        <meta property="og:image" content={post.coverImage} />
        <meta name="twitter:card" content="summary_large_image" />
      </Head>
      <main>...</main>
    </>
  )
}

export const getServerSideProps: GetServerSideProps = async ({ params }) => {
  const post = await fetchPost(params?.slug as string)
  return { props: { post } }
}

Enter fullscreen mode Exit fullscreen mode

Because getServerSideProps runs on the server, the Head content is populated before the HTML reaches the browser. This is what you want.

What not to do: Don't put <Head> tags inside a useEffect. They'll be client-only and won't be seen by crawlers.

One Thing That Helped Me Catch Tag Problems Early

After fixing the core implementation, I was still second-guessing myself on every new page had I remembered canonical URLs? Were the OG image dimensions right? Was the description truncated?

I ended up using a package called @power-seo that audits your metadata at build time and flags issues (missing descriptions, duplicate titles, canonical mismatches) as warnings. You integrate it in your CI pipeline and it catches regressions before they ship.

The setup is straightforward:

npm install @power-seo --save-dev

Enter fullscreen mode Exit fullscreen mode

// In your CI script or as a Next.js plugin
import { auditMetadata } from '@power-seo'

// Runs against your sitemap or a list of URLs
await auditMetadata({
  urls: ['https://yoursite.com', 'https://yoursite.com/blog'],
  rules: ['title', 'description', 'canonical', 'og:image'],
})

Enter fullscreen mode Exit fullscreen mode

It's not magic you still need to write the metadata correctly. But it stops the "wait three weeks to find out Google couldn't see anything" loop. More background on common pitfalls that cause silent SEO failures: https://ccbd.dev/blog/nextjs-seo-meta-tags-mistake-that-cost-3-weeks-of-traffic

What I Learned (The Hard Way)

  • Server-side is non-negotiable. Any metadata set inside useEffect or a client component is invisible to Googlebot. Use generateMetadata or getServerSideProps/getStaticProps always.

  • Canonical URLs prevent duplicate content penalties. If your blog post lives at /blog/my-post and also gets queried at /blog/my-post?ref=twitter, Google sees two URLs with the same content. Add a canonical pointing to the clean URL on every page.

  • OG images need exact dimensions. Twitter/X expects 1200×630px for summary_large_image. A close-but-wrong size often renders as a tiny thumbnail or no image at all. Automate image generation with next/og if your designs allow it.

  • Title templates save time and prevent inconsistency. In the App Router, define a title.template in your root layout.tsx like "%s | My Site" child pages just set the %s part and the suffix is added automatically.

If you want to try this approach, here's the repo: https://ccbd.dev/blog/nextjs-seo-meta-tags-mistake-that-cost-3-weeks-of-traffic

What's the weirdest SEO bug you've hit in a Next.js project? I'm convinced there's an entire graveyard of launches that went unnoticed because of a missing generateMetadata export. Drop your war stories below I'd genuinely love to hear what tripped you up, and maybe we can save someone else the same pain.