Detailed explanation of the role of meta tags in html

黄舟
Release: 2017-06-29 13:27:09
Original
1326 people have browsed it

Many people have ignored the powerful effect of HTML tagsMETA. A good META tag design can greatly improve the possibility of your personal website being searched. Are you interested? Let me get to know you again. Check out the META tag

No matter how wonderful your personal website is, it is just like a small boat in the "vast sea" of cyberspace, and it is not easy to be discovered. How to promote your personal website, there are no methods that people first think of. In addition to the following:

● Log in to your personal website in the search engine

● Add a link to your personal website on a well-known website

● Post a message in the forum Promote your personal website

Many people ignore the powerful effect of the HTML tag META. A good META tag design can greatly increase the possibility of your personal website being searched. Are you interested? Let me know. Let’s get to know the META tag again! The

META tag is an auxiliary tag in the HEAD area of ​​the HTML language. It is located between the HTML documenthead tag and the title << tag. It provides information invisible to the user. . The meta tag is usually used to define the page theme for search engine robots, or to define cookies on the user's browser; it can be used to identify the author, set the page format, mark the content summary and keywords; it can also set the page so that it can be based on You define intervals to refresh yourself, as well as set RASC content levels, etc.

Detailed introduction

The following introduces some examples and explanations of tags.

The META tag is divided into two parts: HTTP header information (HTTP-EQUIV) and page description information (NAME).

★HTTP-EQUIV

HTTP-EQUIV is similar to the header protocol of HTTP. It responds to the browser with some useful information to help display web page content correctly and accurately. Commonly used HTTP-EQUIV types are:

1, Content-Type and Content-Language (display the setting of character set ) transferred from Global Online School edu24ol.com transferred from Global Online School edu24ol.com transferred from Global Online School edu24ol.com

Description: Set the character set used on the page to describe the text and language used to create the homepage. The browser will call the corresponding character set to display the page content based on this.

Usage:

Note: The META tag defines the character set used in HTML pages as GB2132, which is the national standard Chinese character code. If "charset=GB2312" is replaced with "BIG5", the character set used on this page is the Traditional Chinese Big5 code. When you browse some foreign sites, IE browser will prompt you that you need to download xx language support to display the page correctly. This function is to know which character set needs to be used to display the page by reading the Content-Type attribute of the META tag of the HTML page. If the corresponding character set is not installed in the system, IE will prompt for downloading. Other languages ​​also correspond to different charsets. For example, the Japanese character set is "iso-2022-jp" and the Korean character set is "ks_c_5601".

Content-Type Content can also be: text/xml and other document types;

Charset options: ISO-8859-1 (English), BIG5, UTF-8, SHIFT-Jis, Euc, Koi8-2, us-ascii, x-mac-roman, iso-8859-2, x-mac-ce, iso-2022-jp, x-sjis, x-euc-jp, euc-kr, iso- 2022-kr, gb2312, gb_2312-80, x-euc-tw, x-cns11643-1, x-cns11643-2 and other character sets; the Content of Content-Language can also be: EN, FR and other language codes.

2. Refresh (Refresh) Transferred from Global Online School edu24ol.com Transferred from Global Online School edu24ol.com Transferred from Global Online School edu24ol.com

Description: How long (seconds) does it take for the web page to refresh itself, or How long after which to allow web pages to automatically link to other web pages.

Usage:

<Meta http-equiv="Refresh" Content="30">
<Meta http-equiv="Refresh" Content="5; Url=http://www.xia8.net">
Copy after login

Note: The 5 means that it will automatically refresh to the URL after staying for 5 seconds.

3. Expires (Period) Transferred from Global Online School edu24ol.com Transferred from Global Online School edu24ol.com Transferred from Global Online School edu24ol.com

Description: Specify the expiration time of the web page in the cache. Once the web page expires , must be read on the server again.

Usage:

<Meta http-equiv="Expires" Content="0">
<Meta http-equiv="Expires" Content="Wed, 26 Feb 1997 08:21:57 GMT">
Copy after login

Note: You must use the GMT time format, or set it directly to 0 (the number indicates how much time will expire).

4. Pragma (cach mode)

Description: Prohibits the browser from accessing page content from the local machine’s cache.

Usage:

Note: The web page is not saved in the cache, and the page is refreshed every time it is accessed. With this setting, visitors will not be able to browse offline.

5. Set-Cookie (cookie setting)

说明:浏览器访问某个页面时会将它存在缓存中,下次再次访问时就可从缓存中读取,以提高速度。当你希望访问者每次都刷新你广告的图标,或每次都刷新你的计数器,就要禁用缓存了。通常HTML文件没有必要禁用缓存,对于ASP等页面,就可以使用禁用缓存,因为每次看到的页面都是在服务器动态生成的,缓存就失去意义。如果网页过期,那么存盘的cookie将被删除。

用法:

<Meta http-equiv="Set-Cookie" Content="cookievalue=xxx; expires=Wednesday,
21-Oct-98 16:14:21 GMT; path=/">
Copy after login

注意:必须使用GMT的时间格式。

6、Window-target (显示窗口的设定)

说明:强制页面在当前窗口以独立页面显示。

用法:

<Meta http-equiv="Widow-target" Content="_top">
Copy after login

注意:这个属性是用来防止别人在框架里调用你的页面。Content选项:_blank、_top、_self、_parent.

7、Pics-label (网页RSAC等级评定)

说明:在IE的Internet选项中有一项内容设置,可以防止浏览一些受限制的网站,而网站的限制级别就是通过该参数来设置的。

用法::

<META http-equiv="Pics-label" Contect="(PICS-1.1&#39;http://www.rsac.org/ratingsv01.html&#39;I gen comment &#39;RSACi North America Sever&#39; by &#39;inet@microsoft.com&#39;for &#39;http://www.microsoft.com&#39; on &#39;1997.06.30T14:21-0500&#39; r(n0 s0 v0 l0))">
Copy after login

注意:不要将级别设置的太高。RSAC的评估系统提供了一种用来评价Web站点内容的标准。用户可以设置Microsoft Internet Explorer(IE3.0以上)来排除包含有色情和暴力内容的站点。上面这个例子中的HTML取自Microsoft的主页。代码中的(n 0 s 0 v 0 l 0)表示该站点不包含不健康内容。级别的评定是由RSAC,即美国娱乐委员会的评级机构评定的,如果你想进一步了解RSAC评估系统的等级内容,或者你需要评价自己的网站,可以访问RSAC的站点:http://www.rsac.org/.

8、Page-Enter、Page-Exit (进入与退出)

说明:这个是页面被载入和调出时的一些特效。

用法:

<Meta http-equiv="Page-Enter" Content="blendTrans(Duration=0.5)">
<Meta http-equiv="Page-Exit" Content="blendTrans(Duration=0.5)">
Copy after login

二、

name的content指定实际内容。如:如果指定level(等级)为value(值),则Content可能是beginner(初级)、intermediate(中级)、advanced(高级)。

1、Keywords (关键字)

说明:为搜索引擎提供的关键字列表转自环 球 网校edu24ol.com转自环 球 网校edu24ol.com转自环 球 网校edu24ol.com

用法:

<Meta name="Keywords" Content="关键词1,关键词2,关键词3,关键词4,……">
Copy after login

注意:各关键词间用英文逗号“,”隔开。META的通常用处是指定搜索引擎用来提高搜索质量的关键词。当数个META元素提供文档语言从属信息时,搜索引擎会使用lang特性来过滤并通过用户的语言优先参照来显示搜索结果。例如:

<Meta name="Kyewords" Lang="EN" Content="vacation,greece,sunshine">
<Meta name="Kyewords" Lang="FR" Content="vacances,grè:ce,soleil">
Copy after login

2、Description (简介)

说明:Description用来告诉搜索引擎你的网站主要内容。

用法:

<Meta name="Description" Content="你网页的简述">
Copy after login

注意:

3、Robots (机器人向导)转自环 球 网校edu24ol.com转自环 球 网校edu24ol.com转自环 球 网校edu24ol.com

说明:Robots用来告诉搜索机器人哪些页面需要索引,哪些页面不需要索引。Content的参数有all、none、index、noindex、follow、nofollow。默认是all。

用法:

<Meta name="Robots" Content="All|None|Index|Noindex|Follow|Nofollow">
Copy after login

注意:许多搜索引擎都通过放出robot/spider搜索来登录网站,这些robot/spider就要用到meta元素的一些特性来决定怎样登录。

all:文件将被检索,且页面上的链接可以被查询;

none:文件将不被检索,且页面上的链接不可以被查询;(和 "noindex, no follow" 起相同作用)

index:文件将被检索;(让robot/spider登录)

follow:页面上的链接可以被查询;转自环 球 网校edu24ol.com转自环 球 网校edu24ol.com转自环 球 网校edu24ol.com

noindex:文件将不被检索,但页面上的链接可以被查询;(不让robot/spider登录)

nofollow:文件将不被检索,页面上的链接可以被查询。(不让robot/spider顺着此页的连接往下探找)

4、Author (作者)

说明:标注网页的作者或制作组

用法:

<Meta name="Author" Content="张三,abc@sina.com">
Copy after login

注意:Content可以是:你或你的制作组的名字,或Email

5、Copyright (版权)

说明:标注版权转自环 球 网校edu24ol.com转自环 球 网校edu24ol.com转自环 球 网校edu24ol.com

用法:

注意:

6、Generator (编辑器)

说明:编辑器的说明

用法:

<Meta name="Generator" Content="PCDATA|FrontPage|">
Copy after login

注意:Content="你所用编辑器"

7、revisit-after (重访)

说明:

用法:

<META name="revisit-after" CONTENT="7 days" >
Copy after login

注意:

★Head中的其它一些用法

1、scheme (方案)

说明:

scheme can be used when name is used to specify how the value of content shouldbe interpreted.
Copy after login

用法:

<meta scheme="ISBN" name="identifier" content="0-14-043205-1" />
Copy after login

注意:

2、Link (链接)

说明:链接到文件

用法:

<Link href="soim.ico" rel="Shortcut Icon">
Copy after login

注意:很多网站如果你把她保存在收件夹中后,会发现它连带着一个小图标,如果再次点击进入之后还会发现地址栏中也有个小图标。现在只要在你的页头加上这段话,就能轻松实现这一功能。 用来将目前文件与其它 URL 作连结,但不会有连结按钮,用於 标记间, 格式如下:

<link href="URL" rel="relationship">
<link href="URL" rev="relationship">
Copy after login

3、Base (基链接)

说明:插入网页基链接属性转自环 球 网校edu24ol.com转自环 球 网校edu24ol.com转自环 球 网校edu24ol.com

用法:

<Base href="http://www.xia8.net/" target="_blank">
Copy after login

注意:你网页上的所有相对路径在链接时都将在前面加上“http://www.cn8cn.com/”。其中target="_blank"是链接文件在新的窗口中打开,你可以做其他设置。将“_blank”改为“_parent”是链接文件将在当前窗口的父级窗口中打开;改为“_self”链接文件在当前窗口(帧)中打开;改为“_top”链接文件全屏显示。

以上是META标签的一些基本用法,其中最重要的就是:Keywords和Description的设定。为什么呢?道理很简单,这两个语句可以让搜索引擎能准确的发现你,吸引更多的人访问你的站点!根据现在流行搜索引擎(Google,Lycos,AltaVista等)的工作原理,搜索引擎先派机器人自动在WWW上搜索,当发现新的网站时,便于检索页面中的Keywords和Description,并将其加入到自己的数据库,然后再根据关键词的密度将网站排序。

由此看来,我们必须记住添加Keywords和Description的META标签,并尽可能写好关键字和简介。否则,
后果就会是:

● 如果你的页面中根本没有Keywords和Description的META标签,那么机器人是无法将你的站点加入数
据库,网友也就不可能搜索到你的站点。

● 如果你的关键字选的不好,关键字的密度不高,被排列在几十甚至几百万个站点的后面被点击的可
能性也是非常小的。

写好Keywords(关键字)要注意以下几点: 转自环 球 网校edu24ol.com转自环 球 网校edu24ol.com转自环 球 网校edu24ol.com

● 不要用常见词汇。例如www、homepage、net、web等。

● 不要用形容词,副词。例如最好的,最大的等。

● 不要用笼统的词汇,要尽量精确。例如“爱立信手机”,改用“T28SC”会更好。

“三人之行,必有我师”,寻找合适关键词的技巧是:到Google、Lycos、Alta等著名搜索引擎,搜索与
你的网站内容相仿的网站,查看排名前十位的网站的META关键字,将它们用在你的网站上,效果可想而知了。

★小窍门

为了提高搜索点击率,这里还有一些“捷径”可以帮得到你:

● 为了增加关键词的密度,将关键字隐藏在页面里(将文字颜色定义成与背景颜色一样)。

The above is the detailed content of Detailed explanation of the role of meta tags in html. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!