如何解决链接无法在我的Hugo社交共享中部分爬网

问题描述

所以我在灯塔上测试了我的网站,但出现此错误,有人知道如何修复它

erro:链接不可抓取

部分链接上的不可抓取链接

<a class="floating-header-share-tw" aria-label="Twitter" href="https://twitter.com/share?text=5%20%d8%a3%d9%85%d9%88%d8%b1%20%d8%aa%d8%ac…" onclick="window.open(this.href,'share-twitter','width=550,height=235');return false;">
Linkedin

<a class="floating-header-share-in" aria-label="Linkedin" href="https://www.linkedin.com/shareArticle?mini=5%20%d8%a3%d9%85%d9%88%d8%b1%20…" onclick="window.open(this.href,'share-facebook','width=580,height=296');return fals…">
Facebook

<a class="floating-header-share-fb" aria-label="Facebook" href="https://www.facebook.com/sharer/sharer.PHP?u=https%3a%2f%2fmoFeed.netlify.…" onclick="window.open(this.href,height=296');return fals…">

解决方法

那是因为您要用previously answered herereturn false的链接的本机功能禁用。

另外:

  1. 您可能仍然不希望这些链接被爬网,因此您应该考虑添加rel=nofollow
  2. 当您的链接具有可见的锚文本时,应删除aria-label属性,这只会增加噪音,可能会导致听得见aria标签和链接文本的屏幕阅读器用户感到烦恼。