在网页的头部添加链接和元标记的顺序是否有不利影响? [英] Can the order in which adding link and meta tags on head of a webpage have any adverse effect?

查看:143
本文介绍了在网页的头部添加链接和元标记的顺序是否有不利影响?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将这段代码添加到带有.php扩展名的网页中。 $ b

 <?php ?include_once( cssheadertop.php)> 
< link rel =stylesheethref =button.css>
<?php include_once(cssheaderbottom.php)?>

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

 < head> 
< meta charset =utf-8>
< title> 8mags - CSS Lessons< / title>
< meta name =viewportcontent =width = device-width,initial-scale = 1>
< link rel =stylesheethref =../../ bootstrap.min.cssmedia =screen>
< link rel =stylesheethref =../../ 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 / javascriptsrc =http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js>< / script>

cssheaderbottom.php文件包含以下代码:
< pre class =lang-html prettyprint-override> < style>
页面特定样式在这里。
< / style>
< / head>

我想在 $ b之间添加元描述和元关键字标记$ b

 <?php include_once(cssheadertop.php)?> 

 <?php include_once(cssheaderbottom.php)?> 

就像我添加的链接标记。



它能否在渲染或搜索引擎优化中带来任何问题?

解决方案

除了少数例外情况, head 元素无关紧要。也就是说,像搜索引擎这样的消费者当然可以做他们想要的东西(例如,忽略每个第三元素,仅仅为了它的乐趣),但是讨论可能的行为的未指定消费者在这里是无关紧要的。



例外:


I have added this code to my webpage with .php extension

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

Now, cssheadertop.php contains the following code

<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>

The cssheaderbottom.php file has following code

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

I want to add meta description and meta keywords tag between

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

and

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

just like the link tag I have added.

Can it pose any problem in rendering or SEO?

解决方案

Apart from a few exceptions, the order of childs in the head element doesn’t matter.

That said, consumers like search engines may of course do what they want (e.g., ignoring every third element, just for the fun of it), but discussing the possible behaviour of undesignated consumers is off-topic here.

The exceptions:

  • meta-charset should ideally be the first child (i.e., the element must be within the first 1024 bytes of the document, and at best before any non-ASCII characters)

  • base should ideally be the second child (i.e., it must come before any other element in head that has a URI as attribute value)

  • those link and script elements that the user agents wants to process are by default processed in the order they appear

  • the order of link-stylesheet and style elements can play a role for applying CSS

  • the first link-alternate with a type of application/rss+xml or application/atom+xml is the "the default syndication feed for the purposes of feed autodiscovery"

这篇关于在网页的头部添加链接和元标记的顺序是否有不利影响?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆