关于 seo
面向网站优化工作的 SEO 技能,依据 Lighthouse 审计与 Google Search 指南,涵盖技术 SEO、页面优化和结构化数据。
主要功能
- 01技术 SEO 与抓取检查
- 02标题、描述与内容结构优化
- 03JSON-LD 结构化数据建议
- 04移动端与国际 SEO 检查
- 05SEO 审计清单与工具参考
适用场景
- 01检查 robots.txt、站点地图和规范网址
- 02改进页面标题、描述与链接文本
- 03为页面选择并校验结构化数据
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ tech-leads-club/ agent-skills --skill seo安装后在 Claude Code 中输入/seo确认已加载。
详细介绍
SEO 优化
基于 Lighthouse SEO 审核和 Google 搜索指南进行搜索引擎优化。重点关注技术 SEO、页面优化和结构化数据。
SEO 基础知识
搜索排名因素(大致影响):
| 因素 | 影响力 | 本技能 |
|---|---|---|
| 内容质量与相关性 | ~40% | 部分(结构) |
| 反向链接与权威性 | ~25% | ✗ |
| 技术 SEO | ~15% | ✓ |
| 页面体验(Core Web Vitals) | ~10% | 请参阅 Core Web Vitals |
| 页面内 SEO | ~10% | ✓ |
技术 SEO
可抓取性
robots.txt:
# /robots.txt
User-agent: *
Allow: /
# Block admin/private areas
Disallow: /admin/
Disallow: /api/
Disallow: /private/
# Don't block resources needed for rendering
# ❌ Disallow: /static/
Sitemap: https://example.com/sitemap.xml
Meta robots:
<meta name="robots" content="index, follow" />
<meta name="robots" content="noindex, nofollow" />
<meta name="robots" content="index, nofollow" />
<meta name="robots" content="max-snippet:150, max-image-preview:large" />
规范 URL:
<link rel="canonical" href="https://example.com/page" />
<link rel="canonical" href="https://example.com/current-page" />
<link rel="canonical" href="https://example.com/products" />
XML 站点地图
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://example.com/</loc>
<lastmod>2024-01-15</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>https://example.com/products</loc>
<lastmod>2024-01-14</lastmod>
<changefreq>weekly</changefreq>
<priority>0.8</priority>
</url>
</urlset>
站点地图最佳实践:
- 每个站点地图最多包含 50,000 个 URL 或 50MB
- 较大的网站使用站点地图索引
- 仅包含规范且可编入索引的 URL
- 内容变更时更新
lastmod - 提交至 Google Search Console
URL 结构
✅ Good URLs:
https://example.com/products/blue-widget
https://example.com/blog/how-to-use-widgets
❌ Poor URLs:
https://example.com/p?id=12345
https://example.com/products/item/category/subcategory/blue-widget-2024-sale-discount
URL 指南:
- 使用连字符,不要使用下划线
- 仅使用小写字母
- 保持简短(< 75 个字符)
- 自然地包含目标关键词
- 尽可能避免使用参数
- 始终使用 HTTPS
HTTPS 与安全性
<img src="https://example.com/image.jpg" />
<img src="http://example.com/image.jpg" />
用于 SEO 信任信号的安全标头:
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
页面内 SEO
Title 标签
<title>Page</title>
<title>Home</title>
<title>Blue Widgets for Sale | Premium Quality | Example Store</title>
Title 标签指南:
- 50-60 个字符(Google 会在约 60 个字符处截断)
- 将主要关键词放在靠前位置
- 每个页面使用唯一标题
- 品牌名称放在末尾(首页除外)
- 适当时使用行动导向的措辞
Meta 描述
<meta name="description" content="" />
<meta
name="description"
content="Shop premium blue widgets with free shipping. 30-day returns. Rated 4.9/5 by 10,000+ customers. Order today and save 20%."
/>
Meta 描述指南:
- 150-160 个字符
- 自然地包含主要关键词
- 使用有吸引力的行动号召
- 每个页面使用唯一描述
- 与页面内容一致
标题结构
<h2>Welcome to Our Store</h2>
<h4>Products</h4>
<h1>Contact Us</h1>
<h1>Blue Widgets - Premium Quality</h1>
<h2>Product Features</h2>
<h3>Durability</h3>
<h3>Design</h3>
<h2>Customer Reviews</h2>
<h2>Pricing</h2>
标题指南:
- 每个页面使用一个
<h1>(主题) - 遵循逻辑层级(不要跳过级别)
- 自然地包含关键词
- 描述具体,避免泛泛而谈
图片 SEO
<img src="IMG_12345.jpg" />
<img
src="blue-widget-product-photo.webp"
alt="Blue widget with chrome finish, side view showing control panel"
width="800"
height="600"
loading="lazy"
/>
图片指南:
- 使用包含关键词的描述性文件名
- Alt 文本描述图片内容
- 压缩图片并设置合适的尺寸
- 使用 WebP/AVIF,并提供备用格式
- 延迟加载首屏以下的图片
内部链接
<a href="/products">Click here</a>
<a href="/widgets">Read more</a>
<a href="/products/blue-widgets">Browse our blue widget collection</a>
<a href="/guides/widget-maintenance">Learn how to maintain your widgets</a>
链接指南:
- 使用包含关键词的描述性锚文本
- 链接到相关的站内页面
- 合理控制每页的链接数量
- 及时修复失效链接
- 使用面包屑展示层级结构
结构化数据(JSON-LD)
组织
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Organization",
"name": "Example Company",
"url": "https://example.com",
"logo": "https://example.com/logo.png",
"sameAs": ["https://twitter.com/example", "https://linkedin.com/company/example"],
"contactPoint": {
"@type": "ContactPoint",
"telephone": "+1-555-123-4567",
"contactType": "customer service"
}
}
</script>
文章
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Article",
"headline": "How to Choose the Right Widget",
"description": "Complete guide to selecting widgets for your needs.",
"image": "https://example.com/article-image.jpg",
"author": {
"@type": "Person",
"name": "Jane Smith",
"url": "https://example.com/authors/jane-smith"
},
"publisher": {
"@type": "Organization",
"name": "Example Blog",
"logo": {
"@type": "ImageObject",
"url": "https://example.com/logo.png"
}
},
"datePublished": "2024-01-15",
"dateModified": "2024-01-20"
}
</script>
产品
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Product",
"name": "Blue Widget Pro",
"image": "https://example.com/blue-widget.jpg",
"description": "Premium blue widget with advanced features.",
"brand": {
"@type": "Brand",
"name": "WidgetCo"
},
"offers": {
"@type": "Offer",
"price": "49.99",
"priceCurrency": "USD",
"availability": "https://schema.org/InStock",
"url": "https://example.com/products/blue-widget"
},
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "4.8",
"reviewCount": "1250"
}
}
</script>
FAQ
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "FAQPage",
"mainEntity": [
{
"@type": "Question",
"name": "What colors are available?",
"acceptedAnswer": {
"@type": "Answer",
"text": "Our widgets come in blue, red, and green."
}
},
{
"@type": "Question",
"name": "What is the warranty?",
"acceptedAnswer": {
"@type": "Answer",
"text": "All widgets include a 2-year warranty."
}
}
]
}
</script>
面包屑
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [
{
"@type": "ListItem",
"position": 1,
"name": "Home",
"item": "https://example.com"
},
{
"@type": "ListItem",
"position": 2,
"name": "Products",
"item": "https://example.com/products"
},
{
"@type": "ListItem",
"position": 3,
"name": "Blue Widgets",
"item": "https://example.com/products/blue-widgets"
}
]
}
</script>
验证
在以下网站测试结构化数据:
移动端 SEO
响应式设计
<meta name="viewport" content="width=1024" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
点击目标
/* ❌ Too small for mobile */
.small-link {
padding: 4px;
font-size: 12px;
}
/* ✅ Adequate tap target */
.mobile-friendly-link {
padding: 12px;
font-size: 16px;
min-height: 48px;
min-width: 48px;
}
字号
/* ❌ Too small on mobile */
body {
font-size: 10px;
}
/* ✅ Readable without zooming */
body {
font-size: 16px;
line-height: 1.5;
}
国际 SEO
Hreflang 标签
<link rel="alternate" hreflang="en" href="https://example.com/page" />
<link rel="alternate" hreflang="es" href="https://example.com/es/page" />
<link rel="alternate" hreflang="fr" href="https://example.com/fr/page" />
<link rel="alternate" hreflang="x-default" href="https://example.com/page" />
语言声明
<html lang="en">
<html lang="es-MX"></html>
</html>
SEO 审核清单
关键项
- 已启用 HTTPS
- robots.txt 允许抓取
- 重要页面没有
noindex - 已设置 Title 标签且各不相同
- 每个页面仅有一个
<h1>
高优先级
- 已设置 Meta 描述
- 已提交站点地图
- 已设置规范 URL
- 适配移动设备
- Core Web Vitals 达标
中优先级
- 已实施结构化数据
- 已制定内部链接策略
- 已设置图片 Alt 文本
- URL 具有描述性
- 已设置面包屑导航
持续进行
- 在 Search Console 中修复抓取错误
- 内容变更时更新站点地图
- 监控排名变化
- 检查失效链接
- 查看 Search Console 洞察
工具
| 工具 | 用途 |
|---|---|
| Google Search Console | 监控索引,修复问题 |
| Google PageSpeed Insights | 性能 + Core Web Vitals |
| Rich Results Test | 验证结构化数据 |
| Lighthouse | 全面 SEO 审计 |
| Screaming Frog | 爬取分析 |
参考资料
评论
支持 Markdown