简体   繁体   English

为什么 PageSpeed Insights 看不到我的视口元标记?

[英]Why can't PageSpeed Insights see my Viewport Meta Tag?

I've added the code我已经添加了代码

<meta name="viewport" content="width=device-width, initial-scale=1" />

to the HEAD of my webpage the Index.php at DuchyBrass.co.uk DuchyBrass.co.uk 上的 Index.php 到我网页的 HEAD

It is on Line 6 of the source code, but the site runs on a bespoke CMS so the HEAD is defined in its own file and imported.它位于源代码的第 6 行,但该站点在定制的 CMS 上运行,因此 HEAD 在其自己的文件中定义并导入。

index.php索引.php

<!DOCTYPE html>
<html lang='en'>
    <head>
        <?php include 'app/common/head.php'; ?>
    </head>
    <body>

...

head.php头文件

<title>Duchy Brass</title>
<meta charset="windows-1252" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="google-site-verification" content="QsU348JA47VLcAbTUic-Un90bVlGuVk3a9A34doxsvc" />
<link rel="stylesheet" type="text/css" href="css/style.css">
<link href='http://fonts.googleapis.com/css?family=Viga' rel='stylesheet' type='text/css'>
<link rel="icon" type="image/png" href="imgs/favicon.ico">
<link rel="canonical" href="http://www.duchybrass.co.uk" />

As far as the browser is concerned (I assume) that viewport tag is visible, but it is not seen by that Mobile SEO tool.就浏览器而言(我假设),视口标签是可见的,但该移动搜索引擎优化工具看不到它。 Is this something to do with the CMS, loading the information too late, or is this a common issue that I should ignore?这是否与 CMS 有关,加载信息太晚,或者这是我应该忽略的常见问题?

The top of my Index page (using view page source from the browser) looks like我的索引页面的顶部(使用浏览器中的查看页面源)看起来像

/ (page source) /(页面来源)

<!DOCTYPE html>
<html lang='en'>
    <head>
        <title>Duchy Brass</title>
        <meta charset="windows-1252" />
        <meta name="viewport" content="width=device-width, initial-scale=1" />

...

TL;DR: clear caches and check if there is no content before head (ctrl+U) TL;DR:清除缓存并检查 head 之前是否没有内容(ctrl+U)

I had a similar problem, in my case there were content being included trough PHP before my wordpress header call, check it with Ctrl+U (see source) and be sure there is nothing before the我遇到了类似的问题,在我的情况下,在的 wordpress 标头调用之前通过 PHP 包含了内容,使用 Ctrl+U 进行检查(请参阅源代码)并确保在

<!DOCTYPE html>
   <html lang='en'>
      <head>

if you change the code and it persists, check if you're using cache, you may have to clear caches of pages and files so the changes take effect before running another PageSpeed analysis如果您更改代码并且它仍然存在,请检查您是否正在使用缓存,您可能需要清除页面和文件的缓存,以便更改在运行另一个 PageSpeed 分析之前生效

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM