名称: seo 描述: 针对搜索引擎可见性和排名进行优化。当被要求“改善SEO”、“优化搜索”、“修复元标签”、“添加结构化数据”、“站点地图优化”或“搜索引擎优化”时使用。 许可证: MIT 元数据: 作者: web-quality-skills 版本: ‘1.0’
SEO优化
基于Lighthouse SEO审计和Google搜索指南的搜索引擎优化。专注于技术SEO、页面优化和结构化数据。
SEO基础
搜索排名因素(近似影响):
| 因素 | 影响 | 本技能 |
|---|---|---|
| 内容质量与相关性 | ~40% | 部分(结构) |
| 反向链接与权威性 | ~25% | ✗ |
| 技术SEO | ~15% | ✓ |
| 页面体验(核心网页指标) | ~10% | 参见 核心网页指标 |
| 页面内SEO | ~10% | ✓ |
技术SEO
可爬取性
robots.txt:
# /robots.txt
User-agent: *
Allow: /
# 阻止管理/私有区域
Disallow: /admin/
Disallow: /api/
Disallow: /private/
# 不要阻止渲染所需的资源
# ❌ Disallow: /static/
Sitemap: https://example.com/sitemap.xml
元机器人:
<!-- 默认:可索引,可跟踪 -->
<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" />
<!-- 或使用 rel="prev" / rel="next" 用于显式分页 -->
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搜索控制台
URL结构
✅ 好的URL:
https://example.com/products/blue-widget
https://example.com/blog/how-to-use-widgets
❌ 差的URL:
https://example.com/p?id=12345
https://example.com/products/item/category/subcategory/blue-widget-2024-sale-discount
URL指南:
- 使用连字符,而不是下划线
- 仅小写
- 保持简短(< 75字符)
- 自然包含目标关键词
- 尽可能避免参数
- 始终使用HTTPS
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>
<title>首页</title>
<!-- ✅ 描述性带有主关键词 -->
<title>蓝色部件销售 | 优质品质 | 示例商店</title>
标题标签指南:
- 50-60字符(Google截断约60字符)
- 主关键词靠近开头
- 每个页面唯一
- 品牌名称在末尾(除非首页)
- 适当情况下具有行动导向
元描述
<!-- ❌ 缺失或重复 -->
<meta name="description" content="" />
<!-- ✅ 吸引人且唯一 -->
<meta
name="description"
content="购买优质蓝色部件,免费送货。30天退货。10,000+客户评分4.9/5。今天订购并节省20%。"
/>
元描述指南:
- 150-160字符
- 自然包含主关键词
- 吸引人的号召性用语
- 每个页面唯一
- 匹配页面内容
标题结构
<!-- ❌ 差的结构 -->
<h2>欢迎来到我们的商店</h2>
<h4>产品</h4>
<h1>联系我们</h1>
<!-- ✅ 正确的层次 -->
<h1>蓝色部件 - 优质品质</h1>
<h2>产品特点</h2>
<h3>耐用性</h3>
<h3>设计</h3>
<h2>客户评价</h2>
<h2>定价</h2>
标题指南:
- 每个页面单一个
<h1>(主要主题) - 逻辑层次(不要跳过级别)
- 自然包含关键词
- 描述性,非通用
图像SEO
<!-- ❌ 差的图像SEO -->
<img src="IMG_12345.jpg" />
<!-- ✅ 优化的图像 -->
<img
src="blue-widget-product-photo.webp"
alt="带有铬合金饰面的蓝色部件,侧面视图显示控制面板"
width="800"
height="600"
loading="lazy"
/>
图像指南:
- 描述性文件名带关键词
- Alt文本描述图像内容
- 压缩和适当大小
- WebP/AVIF带后备格式
- 懒加载折叠下方图像
内部链接
<!-- ❌ 非描述性 -->
<a href="/products">点击这里</a>
<a href="/widgets">阅读更多</a>
<!-- ✅ 描述性锚文本 -->
<a href="/products/blue-widgets">浏览我们的蓝色部件收藏</a>
<a href="/guides/widget-maintenance">学习如何维护您的部件</a>
链接指南:
- 描述性锚文本带关键词
- 链接到相关内部页面
- 每页合理数量的链接
- 及时修复损坏链接
- 使用面包屑导航表示层次
结构化数据(JSON-LD)
组织
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Organization",
"name": "示例公司",
"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": "客户服务"
}
}
</script>
文章
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Article",
"headline": "如何选择合适的部件",
"description": "选择满足您需求的部件的完整指南。",
"image": "https://example.com/article-image.jpg",
"author": {
"@type": "Person",
"name": "简·史密斯",
"url": "https://example.com/authors/jane-smith"
},
"publisher": {
"@type": "Organization",
"name": "示例博客",
"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": "蓝色部件专业版",
"image": "https://example.com/blue-widget.jpg",
"description": "带有先进功能的优质蓝色部件。",
"brand": {
"@type": "Brand",
"name": "部件公司"
},
"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>
常见问题
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "FAQPage",
"mainEntity": [
{
"@type": "Question",
"name": "有哪些颜色可选?",
"acceptedAnswer": {
"@type": "Answer",
"text": "我们的部件有蓝色、红色和绿色。"
}
},
{
"@type": "Question",
"name": "保修期是多长?",
"acceptedAnswer": {
"@type": "Answer",
"text": "所有部件包含2年保修。"
}
}
]
}
</script>
面包屑导航
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [
{
"@type": "ListItem",
"position": 1,
"name": "首页",
"item": "https://example.com"
},
{
"@type": "ListItem",
"position": 2,
"name": "产品",
"item": "https://example.com/products"
},
{
"@type": "ListItem",
"position": 3,
"name": "蓝色部件",
"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" />
点击目标
/* ❌ 移动设备上太小 */
.small-link {
padding: 4px;
font-size: 12px;
}
/* ✅ 足够的点击目标 */
.mobile-friendly-link {
padding: 12px;
font-size: 16px;
min-height: 48px;
min-width: 48px;
}
字体大小
/* ❌ 移动设备上太小 */
body {
font-size: 10px;
}
/* ✅ 无需缩放即可阅读 */
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 - [ ] 标题标签存在且唯一
- [ ] 每个页面单一个
<h1>
高优先级
- [ ] 元描述存在
- [ ] 站点地图已提交
- [ ] 规范URL设置
- [ ] 移动响应式
- [ ] 通过核心网页指标
中优先级
- [ ] 结构化数据已实施
- [ ] 内部链接策略
- [ ] 图像alt文本
- [ ] 描述性URL
- [ ] 面包屑导航
持续进行
- [ ] 修复搜索控制台中的爬取错误
- [ ] 内容更改时更新站点地图
- [ ] 监控排名变化
- [ ] 检查损坏链接
- [ ] 查看搜索控制台洞察
工具
| 工具 | 用途 |
|---|---|
| Google搜索控制台 | 监控索引,修复问题 |
| Google PageSpeed Insights | 性能 + 核心网页指标 |
| 富搜索结果测试 | 验证结构化数据 |
| Lighthouse | 完整SEO审计 |
| Screaming Frog | 爬取分析 |