简体   繁体   English

如何修复在 Google Lighthouse 上无法抓取链接

[英]How to fix Links are not crawlable on Google Lighthouse

I got error while running google lighthouse.运行谷歌灯塔时出现错误。 the warning is Link not crawable.警告是链接不可抓取。 this is the warning from google lighthouse.这是来自谷歌灯塔的警告。

<a href="https://www.mywebsite.com/en/test.html" id="multipleStore" target="popup" onclick="window.open('https://www.mywebsite.com/en/test.html','My popup windows open','resizable,height=480,width=875'); return false;">
                <p>click me</p>
            </a>

To prevent Google from crawling your link do not use a URL and use script instead.为防止 Google 抓取您的链接,请勿使用 URL 而是使用脚本。

If you use something like this Google Crawler (respectively Lighthouse) will ignore the link:如果您使用类似这样的 Google Crawler(分别为 Lighthouse)将忽略该链接:

<a href="javascript:void(0)" onclick="openPopup()" class="link">click me</a>
<script>
function openPopup() {
    window.open('https://www.google.com/', 'Popup', 'width=400,height=875')
}
</script>

Example: https://codepen.io/headstarterz/pen/eYgMaew示例: https://codepen.io/headstarterz/pen/eYgMaew

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM