在网页头部添加链接和元标记的顺序会产生负面影响吗?

Nit*_*mar 3 html php meta html-head meta-tags

我已将此代码添加到带有 .php 扩展名的网页中

<?php include_once("cssheadertop.php")?>
<link rel="stylesheet" href="button.css">
<?php include_once("cssheaderbottom.php")?>
Run Code Online (Sandbox Code Playgroud)

现在,cssheadertop.php 包含以下代码

<head>
<meta charset="utf-8">
<title>8mags - CSS Lessons</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../../bootstrap.min.css" media="screen">
<link rel="stylesheet" href="../../style.css">
<link href='http://fonts.googleapis.com/css?family=Roboto+Condensed' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Coda' rel='stylesheet' type='text/css'>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
Run Code Online (Sandbox Code Playgroud)

cssheaderbottom.php 文件有以下代码

  <style>
  page specific style here.
  </style>
  </head>
Run Code Online (Sandbox Code Playgroud)

我想在中间添加元描述和元关键字标签

 <?php include_once("cssheadertop.php")?> 
Run Code Online (Sandbox Code Playgroud)

 <?php include_once("cssheaderbottom.php")?>
Run Code Online (Sandbox Code Playgroud)

就像我添加的链接标签一样。

它会在渲染或 SEO 中造成任何问题吗?

uno*_*nor 6

除了少数例外,head元素中子元素的顺序无关紧要。

也就是说,像搜索引擎这样的消费者当然可以做他们想做的事(例如,忽略每三个元素,只是为了好玩),但讨论未指定消费者的可能行为在这里是题外话。

例外情况:

  • meta-charset理想情况下应该是第一个子元素(即,元素必须在文档的前 1024 个字节内,并且最好在任何非 ASCII 字符之前)

  • base理想情况下应该是第二个孩子(即,它必须出现在head具有 URI 作为属性值的任何其他元素之前)

  • 用户代理想要处理的那些linkscript元素默认按照它们出现的顺序进行处理

  • link-stylesheetstyle元素的顺序可以在应用 CSS 中发挥作用

  • 第一link-alternatetypeapplication/rss+xmlapplication/atom+xml为“用于自动发现饲料的目的默认整合馈源”