0

我在我的网站中添加引用外部网站的锚链接。

<a href="externalwebsite.com"  rel="nofollow">external website</a>

这使我的网站显示为引荐网站和/或可能是这些外部网站的流量来源。一些网站管理员不喜欢这样(他们说这会影响他们的 SEO 工作)并要求我删除链接。我想避免这种情况。

有 Javascript 的任何解决方案吗?谢谢

4

1 回答 1

1

您可以尝试使用类创建一个空链接,并让脚本运行 onload 以正确创建这些链接。

以下文章复制自:http ://www.seomofo.com/ethics/using-javascript-to-hide-links.html

1. Remove affiliate links from your pages’ HTML code.
2. If it’s a text link embedded in page content, then just remove the <a> tags
    and leave the anchor text there (as plain text).
3. If it’s an image link, remove the <a> tags AND the <img> tag.
4. Replace the <a> tags with <span> tags, and assign a class name to them
    (e.g. <span class="affiliate">).
5. Write a JavaScript function that looks for <span> elements that contain 
    class="affiliate" and replaces them with your affiliate links. 
    (Yes, the ones you removed in Step 1).
6. Put the JavaScript function in an external .js file and block Google from \
    accessing it (using robots.txt).
7. Attach the JavaScript function to the onload event, which means users’ web 
     browsers won’t call the function until after the page is finished loading.
8. Googlebot–and users without JavaScript enabled–can’t call the JavaScript 
     function, so your affiliate links are never inserted into the page content.
9. Only users with JavaScript-enabled browsers will see your affiliate links. 
    Everything/everyone else sees plain text instead of affiliate text links, 
    and an empty space instead of affiliate image links.
于 2013-03-31T04:17:58.413 回答