html5-meta標簽和搜索引擎


emta標簽的組成:

meta標簽分兩大部分:HTTP-EQUIV  和  NAME  變量。

HTTP-EQUIV:
HTTP-EQUIV類似於HTTP的頭部協議,它回應給瀏覽器一些有用的信息,以幫助正確和精確地顯示網頁內容。
常用的HTTP-EQUIV類型有:
1.expires(期限):
說明:可以用於設定網頁的到期時間。一旦網頁過期,必須到服務器上重新調閱。
用法:

<meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">

注意:必須使用GMT的時間格式。
2.Pragma(cach模式):
說明:禁止瀏覽器從本地機的緩存中調閱頁面內容。
用法:

<meta http-equiv="Pragma" content="no-cache">

注意:這樣設定,訪問者將無法脫機瀏覽。
3.Refresh(刷新):
說明:需要定時讓網頁自動鏈接到其它網頁的話,就用這句了。
用法:

<meta http-equiv="Refresh" content="5;URL=http://www.yahoo.com">

注意:其中的5是指停留5秒鍾后自動刷新到URL網址。
4.Set-Cookie(cookie設定):
說明:如果網頁過期,那么存盤的cookie將被刪除。
用法:

<meta http-equiv="Set-Cookie" content="cookievalue=xxx;expires=Wednesday, 21-Oct-98 16:14:21 GMT; path=/">

注意:必須使用GMT的時間格式。
5.Window-target(顯示窗口的設定):
說明:強制頁面在當前窗口以獨立頁面顯示。
用法:

<meta http-equiv="Window-target" content="_top">

注意:用來防止別人在框架里調用你的頁面。
6.Content-Type(顯示字符集的設定):
說明:設定頁面使用的字符集。(我們在前面字體設計中已經介紹過它的作用)
用法:

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

NAME變量:
meat標簽的NAME變量語法格式是:

<meta name="xxx" content="xxxxxxxxxxxxxxxxxx">

其中xxx主要有下面幾種參數:
1.Keywords(關鍵字):
說明:keywords用來告訴搜索引擎你網頁的關鍵字是什么。
舉例:

<meta name="keywords" content="life, universe, mankind, plants,relationships, the meaning of life, science">

2.description(簡介):
說明:description用來告訴搜索引擎你的網站主要內容。
舉例:

<meta name="description" content="This page is about the meaning of life, the universe, mankind and plants.">

3.robots(機器人向導):
說明:robots用來告訴搜索機器人哪些頁面需要索引,哪些頁面不需要索引。
CONTENT的參數有all,none,index,noindex,follow,nofollow。默認是all。
舉例:

<meta name="robots" content="none">

4.author(作者):
說明:標注網頁的作者
舉例:

<meta name="AUTHOR" content="ajie,ajie@netease.com">

5.應用

<meta charset="utf-8"> //字符集,為了解決語法正常解析
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" /> //瀏覽器兼容
<meta name="description" content="全球最大的中文web技術教程" /> //網頁描述
<meta name="description" content="全球最大的中文web技術教程" /> //網頁描述
<meta name="robots" content="NOINDEX,NOFOLLOW" /> //不讓搜索引擎收到

title:搜索引擎優化

<title>HTML</title>

 link:頁簽logo

<link rel="icon" type="image/png" size="16X16" href="/ui2019/w3.png">


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM