在网页头添加链接和元标记的顺序是否会产生任何不利影响


Can the order in which adding link and meta tags on head of a webpage have any adverse effect?

>我已将此代码添加到我的网页中,扩展名为.php

<?php include_once("cssheadertop.php")?>
<link rel="stylesheet" href="button.css">
<?php include_once("cssheaderbottom.php")?>

现在,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>

cssheaderbottom.php 文件具有以下代码

  <style>
  page specific style here.
  </style>
  </head>

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

 <?php include_once("cssheadertop.php")?> 

 <?php include_once("cssheaderbottom.php")?>

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

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

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

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

例外情况:

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

  • 理想情况下,base应该是第二个子元素(即,它必须位于head中将 URI 作为属性值的任何其他元素之前(

  • 默认情况下,用户代理要处理的那些linkscript元素将按其显示顺序进行处理

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

  • 第一个link - typeapplication/rss+xmlapplication/atom+xmlalternate是"用于源自动发现的默认联合源">