Chrome 缺少Meta标签在头WordPress

bogh5gae  于 12个月前  发布在  Go
关注(0)|答案(1)|浏览(126)

Lighthouse给了我一个错误,我缺少视口Meta标记和描述元标记

Does not have a <meta name="viewport"> tag with width or initial-scaleNo `<meta name="viewport">` tag found

但我在我的在header.php文件中有两个Meta标记

<head>
  <meta name="description" content="Description">
  <meta charset="utf-8">
  <title>My site</title>
  <?php wp_head(); ?>
  <meta name="viewport" content="width=device-width, initial-scale=1">
</head>

编辑:当我在浏览器中检查网站时,我可以看到Meta标签已经自动从标签移动到主体标签。不知道为什么
有人有这个问题吗?我试过在functions.php中添加Meta标签,但也没有找到解决方案。干杯!干杯!

jvlzgdj9

jvlzgdj91#

所以基本上我犯了个愚蠢的错误。在我的page.php我头get_header()函数在错误的地方
之前

<div class="w-large">
 <?php get_header(); ?>
    <?php
    while (have_posts()) : the_post();
        the_content();
    endwhile;
    ?>

</div>

<?php get_footer(); ?>

<div class="w-large">

    <?php
    while (have_posts()) : the_post();
        the_content();
    endwhile;
    ?>

</div>

<?php get_footer(); ?>

相关问题