将指向外部tumblr博客的链接从tumblr帖子的注释部分设置为不可点击



我最近为一个公司帐户建立了一个tumblr博客。在tumblr上,当有人转发或评论一篇帖子时,他们会出现在评论区,在tumblr中称为注释。

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

这些链接都是nofollow,这很好,但问题是其中一些网站可能包含成人内容,因为这是一个商业帐户,所以无法链接到成人内容。

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


更新

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

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

但这些完全删除了注释功能,我更喜欢做的是仍然保留注释,但不允许它们成为链接。


更新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;
});

最新更新