使指向外部 tumblr 博客的链接无法从 tumblr 的注释部分点击 post

Make links to external tumblr blogs not clickable from the notes section of a tumblr post

我最近为公司帐户设置了一个 tumblr 博客。在 tumblr 上,当有人回复 post 或对 post 发表评论时,他们会出现在评论部分,在 tumblr 中称为注释。

例如,请在此处查看此 post:http://minimalist.co/post/49073058900/robert-downey-jr-by-greg-williams#notes - 请参阅底部其他 tumblr 的 link(不是我的 tumblr 博客,但你明白了)

这些 link 都是 nofollow 这很好,但我遇到的问题是其中一些网站可能包含成人内容,因为这是一个企业帐户,它不能 link 到成人内容。

有没有办法从这些 link 中删除 href 这样它们就无法被点击,要么通过编辑 tumblr 主题在服务器端进行,要么在客户端使用 JS 进行?


更新

我发现我可以通过从主题中删除这些行来完全删除注释:

 {block:PostNotes}
 section class="post_notes">
 <a name="notes">
 {PostNotes}
 </a>
 </section>
 {/block:PostNotes}

但是这些完全删除了注释功能,id 更喜欢做的是仍然有注释但不允许它们成为 links。


更新 2

这是页面上使用的 html

<li class="note reblog tumblelog_sixtensason without_commentary">
    <a rel="nofollow" class="avatar_frame" target="_blank" href="http://sixtensason.tumblr.com/" title="Sixten Sason in wonderland" sl-processed="1">
        <img src="http://38.media.tumblr.com/avatar_ed56f53ce743_16.png" class="avatar " alt="">
    </a>

    <span class="action" data-post-url="http://sixtensason.tumblr.com/post/110092976968">

        <a rel="nofollow" href="http://sixtensason.tumblr.com/" class="tumblelog" title="Sixten Sason in wonderland" sl-processed="1">
            sixtensason
        </a> 

        reblogged this from 

        <a rel="nofollow" href="http://example.com" class="source_tumblelog" title="Interior design blog - LLI Design London" sl-processed="1">
            example
        </a>

    </span>

    <div class="clear">
    </div>
</li>

我将 JS 更新到下面,但无济于事,有什么想法吗?

<script type="text/javascript">
            $(document).ready(function(){

                $('span.action a').attr('href','');
                $('li.note a').attr('href','');

            });
        </script>

可能需要查看您的博客或一些更具体的标记,但有一种方法可以使用 jquery 删除 href。

jQuery 往往会随许多模板一起提供,但如果您的模板没有,您只需添加一行代码。

类似于

$(document).ready(function(){
   $('.post_notes a').attr('href','');
});

这表示获取 post_notes 元素内的所有锚点并将 href 设置为空字符串。

检查我的一些主题我可以看到有可以从模板中删除的 tumblr 模板链接,它们看起来像 href="{Permalink}",但我认为对于 postNotes 块你不能编辑 href,因为据我所知。

编辑:

或者您可以禁用点击事件:

$('.post_notes a').click(function(){
   return false;
});