第一章. Meta 标签
第一节 意义:
l 在 head 标签中的 meta 标签,可以为 HTML 文档提供额外的信息
l 此标签是单独出现的
l 只能出现在 head 标签内
l 属性 I18N—xml : lang 国际化属性
l Content
l http-equiv
l id
l name
l scheme
第二节 Content-type 定义文件 MIME 类型
1. content-language 出现在 http-equiv 属性中,使用 content 属性表示页面的 MIME 类型
2. Content-Type := type "/" subtype *[";" parameter]
3. type 通常取值为: application/ audio /image/ message/ multipart/ text/ video
4. charset 定义网页编码信息
a) 使用 utf-8 编码
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
b) 使用中文 gb2312 编码
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
5. content-language 定义页面语言
a) content-language 语法
language-code = primary-code ( "-" subcode )*
b) content-language 示例
<meta http-equiv="content-language" content="zh-CN" />
6. refresh 刷新或者重定向页面
refresh 示例
a) 5 秒之后刷新本页面 :
<meta http-equiv="refresh" content="5" />
b) 5 秒之后转到梦之都首页 :
<meta http-equiv="refresh" content="5; url=http://www.dreamdu.com/" />
7. expires 网页缓存过期时间
expires 示例
<meta http-equiv="expires" content="Sunday 26 October 2008 01:00 GMT" />
8. no-cache 页面缓存
不缓存页面 ( 为了提高速度一些浏览器会缓存浏览者浏览过的页面 , 通过下面的定义 , 浏览器一般不会缓存页面 , 而且浏览器无法脱机浏览 .)
<meta http-equiv="pragma" content="no-cache" />
9. keywords 网页关键词
<meta name="keywords" content="HTML XHTML" />
* keywords 提供的网页关键词通常是为搜索引擎分类网页使用的;
* 可以为网页提供多个关键词,多个关键词应该使用空格分开;
* 不要给网页定义过多的关键词,最好保持在 10 个以下,过多的关键词,搜索引擎将忽略;
* 不要给网页定义与网页描述内容无关的关键词;
* 由于网页制作者滥用 keywords( 提供过多的关键词或者提供与网页无关的关键词 ) ,导致目前常用的搜索引擎降低了 keywords 的重要性。
10. description 网页简短描述
<meta name="description" content="html 教程,完善的 html 内容,使初学者迅速掌握 html 的精髓,猴子编写的梦之,都 html 教程 " />
<meta name="description" content="html toturial and html books" />
* description 提供的网页简短描述通常是为搜索引擎描述网页使用的;
* 网页简短描述不能太长,应该保持在 140-200 个字符或者 100 个左右的汉字;
* 不要给网页定义与网页描述内容无关的简短描述;
* 由于网页制作者滥用 description( 提供与网页无关的简短描述 ) ,导致目前常用的搜索引擎降低了 description 的重要性。
11. author 网页作者
<meta name="author" content="http://www.dreamdu.com/blog/" />
12. copyright 网页版权
<meta name="copyright" content="© http://www.dreamdu.com" />
13. date 网页生成时间
<meta name="date" content="2008-07-12T20:50:30+00:00" />
14. robots 搜索引擎索引方式
a) robots 语法
<meta name="robots" content="robotterms" />
robotterms 是一组使用逗号 (,) 分割的值,通常有如下几种取值: none , noindex , nofollow , all , index 和 follow 。
b) robots 取值
none
搜索引擎将忽略此网页,等价于 noindex , nofollow 。
noindex
搜索引擎不索引此网页。
nofollow
搜索引擎不继续通过此网页的链接索引搜索其它的网页。
all
搜索引擎将索引此网页与继续通过此网页的链接索引,等价于 index , follow 。
index
搜索引擎索引此网页。
follow
搜索引擎继续通过此网页的链接索引搜索其它的网页。
c) 针对谷歌 GOOGLEBOT 使用 robots
可以将 name 的属性只定义为 GOOGLEBOT 标识为谷歌搜索引擎。 使用元标记拦截或删除网页
<meta name="googlebot" content="noindex, nofollow" />
d) 针对百度 baiduspider 使用 robots
可以将 name 的属性只定义为 baiduspider 标识为百度搜索引擎。 禁止搜索引擎收录的方法
<meta name="baiduspider" content="noarchive" />
e) 拾遗:
There are two important considerations when using the robots <META> tag:
* robots can ignore your <META> tag. Especially malware robots that scan the web for security vulnerabilities, and email address harvesters used by spammers will pay no attention.
* the NOFOLLOW directive only applies to links on this page. It's entirely likely that a robot might find the same links on some other page without a NOFOLLOW (perhaps on some other site), and so still arrives at your undesired page.