Claude Code के साथ SEO Implementation
Claude Code का उपयोग करके SEO implementation के बारे में जानें। Practical tips और code examples शामिल हैं।
Breadcrumb से UX और SEO दोनों improve करें
Breadcrumb (पाथ navigation) एक navigation element है जो user को visually दिखाता है कि वो site में कहाँ है। सही implementation से usability improvement और SEO improvement दोनों simultaneously achieve हो सकते हैं।
Basic Breadcrumb Component
> Breadcrumb component बनाओ।
> Structured data (JSON-LD) support, accessibility consideration, responsive support के साथ।
// components/Breadcrumb.tsx
interface BreadcrumbItem {
label: string;
href?: string;
}
interface BreadcrumbProps {
items: BreadcrumbItem[];
}
export function Breadcrumb({ items }: BreadcrumbProps) {
const jsonLd = {
'@context': 'https://schema.org',
'@type': 'BreadcrumbList',
itemListElement: items.map((item, index) => ({
'@type': 'ListItem',
position: index + 1,
name: item.label,
item: item.href ? `https://example.com${item.href}` : undefined,
})),
};
return (
<>
<script
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd) }}
/>
<nav aria-label="Breadcrumb" className="breadcrumb">
<ol className="flex flex-wrap items-center gap-1 text-sm text-gray-600">
{items.map((item, index) => (
<li key={index} className="flex items-center">
{index > 0 && (
<span className="mx-2 text-gray-400" aria-hidden="true">/</span>
)}
{item.href && index < items.length - 1 ? (
<a
href={item.href}
className="text-blue-600 hover:underline"
>
{item.label}
</a>
) : (
<span aria-current="page" className="text-gray-800 font-medium">
{item.label}
</span>
)}
</li>
))}
</ol>
</nav>
</>
);
}
URL से Breadcrumb Auto-Generate करना
// utils/breadcrumb.ts
const labelMap: Record<string, string> = {
blog: 'Blog',
category: 'Category',
tags: 'Tags',
about: 'About',
};
export function generateBreadcrumbs(pathname: string): BreadcrumbItem[] {
const segments = pathname.split('/').filter(Boolean);
const items: BreadcrumbItem[] = [
{ label: 'Home', href: '/' },
];
let currentPath = '';
segments.forEach((segment, index) => {
currentPath += `/${segment}`;
const isLast = index === segments.length - 1;
items.push({
label: labelMap[segment] || decodeURIComponent(segment),
href: isLast ? undefined : currentPath,
});
});
return items;
}
Astro में Integration Example
---
// layouts/BlogPost.astro
import { Breadcrumb } from '../components/Breadcrumb';
const { frontmatter } = Astro.props;
const breadcrumbItems = [
{ label: 'Home', href: '/' },
{ label: 'Blog', href: '/blog' },
{ label: frontmatter.category, href: `/blog/category/${frontmatter.category}` },
{ label: frontmatter.title },
];
---
<Breadcrumb items={breadcrumbItems} />
Styling Variations
/* Arrow style */
.breadcrumb-arrow li + li::before {
content: '›';
margin: 0 0.5rem;
color: #9ca3af;
}
/* Icon style */
.breadcrumb-icon li:first-child a::before {
content: '';
display: inline-block;
width: 16px;
height: 16px;
background: url('/icons/home.svg') no-repeat center;
margin-right: 4px;
vertical-align: middle;
}
/* Mobile: सिर्फ last 2 दिखाएं */
@media (max-width: 640px) {
.breadcrumb li:not(:nth-last-child(-n+2)) {
display: none;
}
.breadcrumb li:nth-last-child(2)::before {
content: '... / ';
}
}
Testing
import { describe, it, expect } from 'vitest';
import { generateBreadcrumbs } from './breadcrumb';
describe('generateBreadcrumbs', () => {
it('Top page', () => {
const result = generateBreadcrumbs('/');
expect(result).toEqual([{ label: 'Home', href: '/' }]);
});
it('Blog article page', () => {
const result = generateBreadcrumbs('/blog/my-article');
expect(result).toHaveLength(3);
expect(result[1]).toEqual({ label: 'Blog', href: '/blog' });
expect(result[2].href).toBeUndefined();
});
});
Summary
Breadcrumb SEO optimization और accessibility दोनों के लिए important component है। Claude Code से structured data support तक implement करवाने पर Google search results में breadcrumb display होने लगता है। Structured data की details के लिए Google Search Central देखें।
मुफ़्त PDF: 5 मिनट में Claude Code चीटशीट
बस अपना ईमेल दर्ज करें और हम तुरंत A4 एक-पृष्ठ चीटशीट PDF भेज देंगे।
हम आपकी व्यक्तिगत जानकारी की सुरक्षा करते हैं और स्पैम नहीं भेजते।
लेखक के बारे में
Masa
Claude Code का गहराई से उपयोग करने वाले इंजीनियर। claudecode-lab.com चलाते हैं, जो 10 भाषाओं में 2,000 से अधिक पेजों वाला टेक मीडिया है।
संबंधित लेख
Claude Code ke liye 7 CLAUDE.md templates jo aap real projects me copy kar sakte hain
Solo app, content site, API, team repo aur legacy codebase ke liye 7 practical CLAUDE.md templates, plus common failure cases.
Claude Code Approval aur Sandbox Guide | Roz ke kaam ke liye safe settings
Claude Code me allow, ask, deny aur sandbox ko kaise baantna chahiye - practical settings, hooks aur real workflow examples ke saath.
Claude Code की सम्पूर्ण शुरुआती गाइड 2026 | शून्य से प्रोफेशनल उपयोग तक 7 स्टेप्स में
पहली बार Claude Code उपयोग करने वालों के लिए पूरी गाइड। इंस्टॉलेशन से लेकर असली डेवलपमेंट वर्कफ्लो में शामिल करने तक — Masa के शुरुआती अनुभव के आधार पर।