问题
将网站收录到必应站点管理工具后,利用必应URL扫描后发现了SEO问题
"问题与什么有关?<h1> 标记是 Bingbot 的标志,用于告知网站访问者广告正文的主要主题。<h1> 标记会进一步强调标题、描述和广告正本中出现的核心关键字。我们建议 <h1> 标记包含的关键字能够反映页面的内容,并且长度不得超过大约 150 个字符。 如何修复?使用 <h1> 标记向页面添加一个标头,然后将该标头置于页面源代码的 <body> 中。"
原因
argon主题文件中 header.php文件里,标题实现方式缺少h1标签
<a class="navbar-brand navbar-title" href="<?php bloginfo('url');
?>"><?php echo $toolbar_title;?></a>
文章页和其它页面也缺少h1标签
<a class="post-title" href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
解决方法
在word press后台选中外观--主题文件编辑器
找到并打开header.php
找到以下代码大概在第 417-419 行位置:
<div id="banner_container" class="banner-container container text-center">
<?php if ($enable_banner_title_typing_effect != "true"){?>
<div class="banner-title text-white"><span class="banner-title-inner">
<?php echo apply_filters('argon_banner_title_html', $banner_title); ?></span>
需要将这里的 <div class="banner-title text-white"> 改为 <h1 class="banner-title text-white">
同时在打字效果部分大概第 421-422 行位置:
<?php } else {?>
<div class="banner-title text-white" data-interval="
<?php echo get_option('argon_banner_typing_effect_interval', 100); ?>">
也需要将 <div 改为 <h1
[alert]注意:相应的结束标签 </div> 也要改为 </h1>[/alert]
保存修改
打开content-single.php大概在第28行位置:
<a class="post-title" href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
在content-single.php文件中,文章标题使用的是<a>标签而不是<h1>
改为
<h1 class="post-title"> <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> </h1>
保存修改
验证方法
进入word press前台,右键查看源代码,按Ctrl+F搜索"<h1"
得到的结果应类似
<h1 class="banner-title text-white" data-interval="100"> <span data-text="网站名称" class="banner-title-inner"> </span> <span data-text="网站副标题" class="banner-subtitle d-block"> </span> </h1>
<h1 class="post-title"> <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> </h1>
大功告成
效果


Comments 3 条评论
很有见地
这是一篇佳作,无论是从内容、语言还是结构上,都堪称完美。
@shinebay 感谢盛赞