为typecho文章页添加百度收录检测

最新资讯 加载中 118字 2642 度

前言

今天无事Travelling的时候看见了一篇文章
为Typecho添加百度收录检测
简单的在文章页面调试了下,效果挺好

教程使用

1.在post.php里面插入(其它模板请自行修改格式)

<span class="item"><i class="iconfont icon-liulanqi"></i></span><spanclass="meta-value" id="baidu_result">加载中</span>

2.还是在post.php内,必须引入jquery

<script>
    function baidu_check(){
        $.getJSON("https://www.yamdr.cn/slcx/baidu.php?domain="+window.location.href,function(result){ 
            if (result.code == 200) {
                $('#baidu_icon').removeClass('glyphicon-refresh');
                $('#baidu_icon').addClass('glyphicon-ok-circle');
                $('#baidu_result').text('百度已收录');
            }else if(result.code == 403){
                $('#baidu_icon').removeClass('glyphicon-refresh');
                $('#baidu_icon').addClass('glyphicon-info-sign');
                $('#baidu_result').text('百度未收录');
            }else{
                $('#baidu_icon').removeClass('glyphicon-refresh');
                $('#baidu_icon').addClass('glyphicon-remove-circle');
                $('#baidu_result').text('查询失败');
            }
        });
    }
    baidu_check();
</script>

作者为了防止API挂掉,把API的代码也放了出来,懒得搭建的小伙伴也可以使用我的

https://www.yamdr.cn/slcx/baidu.php?domain=

取消

感谢您的支持,我会继续努力哒!

扫码打赏,支付金额随意哦!

打开支付宝扫一扫,即可进行扫码打赏哦

我们要学会不再频频回头