DEV Community

Cover image for 7 SEO Mistakes Developers Make (and How to Fix Them in Code)
Mritunjoy Mondal
Mritunjoy Mondal

Posted on

7 SEO Mistakes Developers Make (and How to Fix Them in Code)

You built a fast, clean site. It still doesn't rank. In most audits I run, the problem isn't content. It's small dev decisions that quietly block Google.

Here are the 7 mistakes I see most, with the code to fix each one.

1. Blocking Google in robots.txt

A staging rule gets pushed to production and the whole site disappears from Google.

Bad:

User-agent: *
Disallow: /
Enter fullscreen mode Exit fullscreen mode

Fix:

User-agent: *
Disallow: /admin/
Sitemap: https://yoursite.com/sitemap.xml
Enter fullscreen mode Exit fullscreen mode

Always check yoursite.com/robots.txt after every deploy.

2. Leaving noindex on live pages

Same story, different file. A noindex meta tag from staging survives launch.

<!-- Remove this on production -->
<meta name="robots" content="noindex, nofollow">
Enter fullscreen mode Exit fullscreen mode

Pro tip: control it with an env variable so it can never leak.

const robots = process.env.NODE_ENV === 'production'
  ? 'index, follow'
  : 'noindex, nofollow';
Enter fullscreen mode Exit fullscreen mode

3. Content that only exists after JavaScript runs

If your page is empty until React fetches data, Google may index a blank page or delay indexing for weeks.

Fix:

  • Use SSR or SSG (Next.js, Nuxt, Astro, SvelteKit)
  • At least render title, H1, main text and links on the server
  • Test with Search Console > URL Inspection > View crawled page

4. Missing or duplicate titles

Every page shipping with the same <title>My App</title> is one of the most common issues I find.

Next.js example:

export const metadata = {
  title: 'Local SEO Checklist for Small Businesses',
  description: 'A step by step local SEO checklist to rank in Google Maps.',
  alternates: { canonical: 'https://yoursite.com/local-seo-checklist' },
};
Enter fullscreen mode Exit fullscreen mode

Rules:

  • Unique title per page, under 60 characters
  • Unique description, around 150 characters
  • Self-referencing canonical on every page

5. Using divs and buttons instead of real links

Google follows <a href>. It does not click your buttons.

Bad:

<div onclick="router.push('/pricing')">Pricing</div>
Enter fullscreen mode Exit fullscreen mode

Good:

<a href="/pricing">Pricing</a>
Enter fullscreen mode Exit fullscreen mode

If Google can't follow your navigation, it can't find your pages.

6. Ignoring Core Web Vitals

Speed is a ranking signal and a conversion killer.

Metric Target Common dev fix
LCP Under 2.5s Preload hero image, serve WebP/AVIF
INP Under 200ms Split bundles, defer third party scripts
CLS Under 0.1 Set width and height on images and embeds
<link rel="preload" as="image" href="/hero.webp">
<img src="/hero.webp" width="1200" height="600" alt="Product dashboard">
Enter fullscreen mode Exit fullscreen mode

7. No structured data

Schema helps Google and AI tools like ChatGPT understand who you are and what the page is about.

<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "Article",
  "headline": "7 SEO Mistakes Developers Make",
  "author": {
    "@type": "Person",
    "name": "Mritunjoy Mondal",
    "url": "https://mritunjoymondal.com/"
  }
}
</script>
Enter fullscreen mode Exit fullscreen mode

Validate it with Google's Rich Results Test before you ship.

Pre-launch SEO checklist

Copy this into your PR template:

  • [ ] robots.txt allows crawling
  • [ ] No noindex on production
  • [ ] Main content renders server side
  • [ ] Unique title, description, canonical per page
  • [ ] Navigation uses real <a href> links
  • [ ] Images have width, height, alt text
  • [ ] XML sitemap live and submitted
  • [ ] Schema validated

Wrapping up

None of these are hard fixes. They're just easy to miss when you're shipping fast. Fix them once, add them to your checklist, and your next launch starts with a clean SEO foundation.

I write more practical guides like this on technical SEO and AI search. If your site is live but not ranking, drop a comment and I'll point out what to check first.


I'm Mritunjoy Mondal, an AI, GEO and Local SEO expert from India.

Top comments (0)