You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

基于TypeScript实现orphan pages检测、PageRank风格link equity计算及链接建议

SEO审计工具内部链接结构分析实现方案

核心需求

  • 查找孤立页面(Orphan Pages):无其他页面指向的页面,爬虫无法发现
  • 计算类PageRank的链接权重分数(Link Equity Scores):识别权威度最高的页面
  • 基于主题重叠的上下文链接建议:为未互链的页面提供关联链接推荐

已尝试的方案(存在缺陷)

// 手动检测孤立页面——时间复杂度O(n²)且难以维护
const allLinks = pages.flatMap(p => p.links);
const orphans = pages.filter(p => !allLinks.includes(p.url));
// 无link equity评分、无链接建议、无图结构

现有方案的问题

  • URL标准化问题:尾部斜杠导致匹配遗漏
  • 无法统计页面的入站/出站链接数量
  • 无法计算全站范围内的相对链接权威度
  • 无基于主题的链接建议

目标实现功能及代码示例

1. 构建有向链接图

const graph = buildLinkGraph([
  { url: 'https://example.com/', links: ['https://example.com/blog', 'https://example.com/about'] },
  { url: 'https://example.com/blog', links: ['https://example.com/'] },
  { url: 'https://example.com/about', links: ['https://example.com/'] },
  { url: 'https://example.com/orphan', links: [] },
]);

2. 查找孤立页面

const orphans = findOrphanPages(graph);
// 返回结果:[{ url: 'https://example.com/orphan', outboundCount: 0 }]

3. 查看图节点的链接统计

const blogNode = graph.nodes.get('https://example.com/blog');
console.log(blogNode.inboundCount);  // 输出:1
console.log(blogNode.outboundCount); // 输出:1

4. 计算类PageRank的链接权重分数

const equity = analyzeLinkEquity(graph, { damping: 0.85, iterations: 20 });
// 返回结果示例:
// [
//   { url: 'https://example.com/', score: 0.48, inboundCount: 2 },
//   { url: 'https://example.com/blog', score: 0.18, inboundCount: 1 },
// ]

5. 基于关键词重叠的链接建议

const suggestions = suggestLinks([
  { url: '/guide/react-seo', title: 'React SEO Guide', content: '...' },
  { url: '/guide/meta-tags', title: 'HTML Meta Tags Explained', content: '...' },
], { minRelevance: 0.15, maxSuggestions: 3 });

内容的提问来源于stack exchange,提问作者Al Amin

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.01 16:53:09