新闻网站技术 SEO:抓取预算、索引与架构

新闻网站由于内容量大、需要实时发布以及对抓取预算的高度需求,面临着独特的技术 SEO 挑战。本指南涵盖了必不可少的技术优化措施。

新闻网站架构挑战

高频发布的影响

新闻网站通常每天发布 50 到 500 篇以上的文章,由此产生:

新闻网站的 URL 架构

推荐的 URL 结构

/{year}/{month}/{day}/{slug}/
/2025/06/15/google-algorithm-update/

URL 规则

  1. 在 URL 中包含发布日期
  2. 保持 URL 稳定(发布后绝不更改)
  3. 使用连字符,而非下划线
  4. 控制在 100 个字符以内
  5. 避免使用参数和会话 ID

URL 反面模式

Bad: /article?id=12345
Bad: /news/2025/06/15/google-update?ref=twitter
Bad: /p/google-algorithm-update-2025-june

Good: /2025/06/15/google-algorithm-update/

抓取预算优化

理解新闻网站的抓取预算

Google 基于以下因素分配抓取预算:

最大化抓取效率

  1. 优化 robots.txt
User-agent: Googlebot-news
Allow: /
Disallow: /admin/
Disallow: /search/

User-agent: *
Allow: /
Disallow: /admin/
Disallow: /search/
Disallow: /tags/
Sitemap: https://example.com/news-sitemap.xml
Sitemap: https://example.com/sitemap.xml
  1. 减少抓取浪费
  1. 优先处理新鲜内容

新闻站点地图策略

双站点地图方案

运行两个站点地图:

  1. 新闻站点地图:仅包含最近 48 小时内的文章
  2. 常规站点地图:所有常青内容和历史内容

自动化站点地图更新

import glob
import json
from datetime import datetime, timedelta

def generate_news_sitemap(articles, output_path):
    cutoff = datetime.now() - timedelta(hours=48)
    recent = [a for a in articles if a['published'] > cutoff]

    xml = ['<?xml version="1.0" encoding="UTF-8"?>']
    xml.append('<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"')
    xml.append('        xmlns:news="http://www.google.com/schemas/sitemap-news/0.9">')

    for article in recent:
        xml.append(f'  <url>')
        xml.append(f'    <loc>{article["url"]}</loc>')
        xml.append(f'    <news:news>')
        xml.append(f'      <news:publication>')
        xml.append(f'        <news:name>Example News</news:name>')
        xml.append(f'        <news:language>en</news:language>')
        xml.append(f'      </news:publication>')
        xml.append(f'      <news:publication_date>{article["published"].isoformat()}</news:publication_date>')
        xml.append(f'      <news:title>{article["title"]}</news:title>')
        xml.append(f'    </news:news>')
        xml.append(f'  </url>')

    xml.append('</urlset>')

    with open(output_path, 'w') as f:
        f.write('\n'.join(xml))

索引策略

新闻的快速索引

对于新闻索引而言,速度至关重要:

  1. Indexing API:实时提交新闻内容
  2. 新闻站点地图:每 15 分钟更新一次
  3. Ping Google:通知站点地图的更新
  4. 社交信号:在社交媒体上分享以加快发现速度
  5. 内部链接:立即从首页进行链接

Indexing API 实现

from google.oauth2 import service_account
from googleapiclient.discovery import build

def notify_google_indexing(url, credentials_path):
    credentials = service_account.Credentials.from_service_account_file(
        credentials_path,
        scopes=['https://www.googleapis.com/auth/indexing']
    )
    service = build('indexing', 'v3', credentials=credentials)

    body = {
        'url': url,
        'type': 'URL_UPDATED'
    }

    return service.urlNotifications().publish(body=body).execute()

重复内容管理

常见的重复问题

新闻网站面临着独特的重复内容问题:

解决方案

  1. canonical 标签:始终指定规范 URL
  2. 归档页 noindex:标签页和分类页
  3. 重定向打印 URL:301 跳转到规范版本
  4. 转载处理:使用 canonical 或 syndication-source meta
  5. 一致的 URL:每篇文章对应单一 URL

归档策略

组织历史内容

归档的 SEO 价值

历史新闻内容能够提供: