A-A+

给WordPress主题增加头条搜索的“时间因子提交”功能

2026年02月25日 站长推荐 暂无评论

时间因子提交是头条搜索为了解决:目前站外存在落地页页面时间标注不清、页面无时间等对用户浏览体验不友好情况。开放对落地页时间因子的提交规范,有助于帮助搜索用户获得更满意的搜索浏览体验,帮助优质站点获取更多展现机会。

时间因子的格式是什么?

  1. <meta property=”bytedance:published_time” content=”2022-12-11T12:28:44+01:00″ />  
  2. <meta property=”bytedance:lrDate_time” content=”2022-03-13T15:01:40+01:00″ />  
  3. <meta property=”bytedance:updated_time” content=”2022-03-13T15:01:40+01:00″ />  

将代码放到标签中,帮助站点收录展示时间字段,有助于帮助站点优化落地页体验 · 请替换标签中的content字段值为真实的内容发布时间,时间格式:2022-03-13T15:01:40+01:00

字段解释:

published_time 内容发布时间

updated_time 内容更新时间

lrDate_time 内容最新回复时间

主题修改方法

在header.php中加入:

  1. <?php  
  2. /** 
  3.  * 头条搜索:时间因子 
  4.  */  
  5. if( is_single() ) {  
  6. $pTime = get_the_time( 'U' );  
  7. $uTime = get_the_modified_time( 'U' );  
  8. $lTime = get_the_date( DATE_W3C );  
  9. if$pTime !== $uTime ){  
  10.   $lTime = get_the_modified_time( DATE_W3C );  
  11. }?>  
  12. <?php if(get_the_date( DATE_W3C )){?>  
  13. <meta property="bytedance:published_time" content="<?php echo get_the_date( DATE_W3C );?>" />  
  14. <?php }?>  
  15. <?php if(get_the_modified_time( DATE_W3C )){?>  
  16. <meta property="bytedance:lrDate_time" content="<?php echo get_the_modified_time( DATE_W3C );?>" />  
  17. <?php }?>  
  18. <meta property="bytedance:updated_time" content="<?php echo $lTime;?>" />  
  19. <?php }?>  

通过上面方法就可以完成在WordPress主题中增加头条搜索的“时间因子提交”功能了。

标签:

给我留言