出图率对于seo的重要性不言而喻,一般来说一篇文章想要有搜索图片展示是需要一段时间的并且文章内还要有符合要求的图片才行,在保障文章质量和站点整体质量情况下出图率也不一定会很高,那么还有什么办法提高百度移动端的出图率呢?
肯定还是有办法的,我们可以直接用百度自己提供的“搜索结果出图工具”,具体位置在百度搜索资源平台移动专区,然后找到下图:
然后根据百度的提示以及你自己的网站系统进行操作即可,下面我以wordpress简单举例:
①:找到wordpress你所用主题的文件夹,在里面找到header.php文件。
②:复制下面的代码到header.php文件的</head>标签之前即可,注意熊掌id填写自己在后台显示的ID。
<?php if(is_single()||is_page()){ echo'<scripttype="application/ld+json">{ "@context":"https://ziyuan.baidu.com/contexts/cambrian.jsonld", "@id":"'.get_the_permalink().'", "appid":"这里请填写熊掌号ID", "title":"'.get_the_title().'", "images":["'.fanly_post_imgs().'"], "pubDate":"'.get_the_time('Y-m-d\TH:i:s').'" }</script> ';} //获取文章中的图 functionfanly_post_imgs(){ global$post; $src=''; $content=$post->post_content; preg_match_all('/<img.*?src=[\"|\'](.+?)[\"|\'].*?>/',$content,$strResult,PREG_PATTERN_ORDER); $n=count($strResult[1]); if($n>=3){ $src=$strResult[1][0].'","'.$strResult[1][1].'","'.$strResult[1][2]; }elseif($n>=1){ $src=$strResult[1][0]; } return$src; } ?>