Nofollow在CKEditor中的链接上 [英] Nofollow on links in CKEditor

查看:71
本文介绍了Nofollow在CKEditor中的链接上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道我可以在CKEditor中设置什么位置,因此即使用户未指定,添加的所有链接都将具有rel = nofollow?

Does anyone know where in CKEditor I can setup, so all links added will have rel="nofollow", even if the users don't specify it?

推荐答案

您可以按照此页面上的说明创建数据过滤器,以检查每个链接:
http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Data_Processor

You can create a data filter as explained in this page that checks every link: http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Data_Processor

此(未经测试)代码应该或多或少是您所需要的:

This (untested) code should be more or less what you need:

editor.dataProcessor.htmlFilter.addRules(
{
    elements :
    {
        a : function( element )
        {
            if ( !element.attributes.rel )
                element.attributes.rel = 'nofollow';
        }
    }
});

这篇关于Nofollow在CKEditor中的链接上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆