<meta> 標籤

來源:互聯網
上載者:User

標籤:識別   屬性   pat   scale   取值   顏色   hone   sch   value   

提示和注釋:

注釋:<meta> 標籤永遠位於 head 元素內部。

注釋:中繼資料總是以名稱/值的形式被成對傳遞的。

必需的屬性
屬性 描述
content some_text 定義與 http-equiv 或 name 屬性相關的元資訊
可選的屬性
屬性 描述
http-equiv
  • content-type
  • expires
  • refresh
  • set-cookie
把 content 屬性關聯到 HTTP 頭部。
name
  • author
  • description
  • keywords
  • generator
  • revised
  • others
把 content 屬性關聯到一個名稱。
scheme some_text 定義用於翻譯 content 屬性值的格式。

SEO最佳化 

參考文檔 

頁面關鍵詞,每個網頁應具有描述該網頁內容的一組唯一的關鍵字。 
使用人們可能會搜尋,並準確描述網頁上所提供資訊的描述性和代表性關鍵字及短語。標記內容太短,則搜尋引擎可能不會認為這些內容相關。另外標記不應超過 874 個字元。 


複製代碼代碼如下:<meta name="keywords" content="your tags" />



頁面描述,每個網頁都應有一個不超過 150 個字元且能準確反映網頁內容的描述標籤。

複製代碼代碼如下:<meta name="description" content="150 words" />

 

搜尋引擎索引方式,robotterms是一組使用逗號(,)分割的值,通常有如下幾種取值:none,noindex,nofollow,all,index和follow。確保正確使用nofollow和noindex屬性值。

 

複製代碼代碼如下:
<meta name="robots" content="index,follow" />
<!--
all:檔案將被檢索,且頁面上的連結可以被查詢;
none:檔案將不被檢索,且頁面上的連結不可以被查詢;
index:檔案將被檢索;
follow:頁面上的連結可以被查詢;
noindex:檔案將不被檢索;
nofollow:頁面上的連結不可以被查詢。
-->

 

頁面重新導向和重新整理:content內的數字代表時間(秒),既多少時間後重新整理。如果加url,則會重新導向到指定網頁(搜尋引擎能夠自動檢測,也很容易被引擎視作誤導而受到懲罰)。

 

複製代碼代碼如下:
<meta http-equiv="refresh" content="0;url=" /> 

 

其他

 

複製代碼代碼如下:
<meta name="author" content="author name" /> <!-- 定義網頁作者 -->
<meta name="google" content="index,follow" />
<meta name="googlebot" content="index,follow" />
<meta name="verify" content="index,follow" /> 



行動裝置 

viewport:能最佳化行動瀏覽器的顯示。如果不是響應式網站,不要使用initial-scale或者禁用縮放。 
大部分4.7-5寸裝置的viewport寬設為360px;5.5寸裝置設為400px;iphone6設為375px;ipone6 plus設為414px。


複製代碼代碼如下:
<meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=no"/>
<!-- `width=device-width` 會導致 iPhone 5 添加到主屏後以 WebApp 全螢幕模式開啟頁面時出現黑邊 --> 

 

1.width:寬度(數值 / device-width)(範圍從200 到10,000,預設為980 像素)
2.height:高度(數值 / device-height)(範圍從223 到10,000)
3.initial-scale:初始的縮放比例 (範圍從>0 到10)
4.minimum-scale:允許使用者縮放到的最小比例
5.maximum-scale:允許使用者縮放到的最大比例
6.user-scalable:使用者是否可以手動縮 (no,yes)
7.minimal-ui:可以在頁面載入時最小化上下狀態列。(已棄用)
注意,很多人使用initial-scale=1到非響應式網站上,這會讓網站以100%寬度渲染,使用者需要手動移動頁面或者縮放。如果和initial-scale=1同時使用user-scalable=no或maximum-scale=1,則使用者將不能放大/縮小網頁來看到全部的內容。

WebApp全螢幕模式:偽裝app,離線應用。

 

複製代碼代碼如下:
<meta name="apple-mobile-web-app-capable" content="yes" /> <!-- 啟用 WebApp 全螢幕模式 --> 

 

隱藏狀態列/設定狀態列顏色:只有在開啟WebApp全螢幕模式時才生效。content的值為default | black | black-translucent 。

 

複製代碼代碼如下:
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" /> 

 

添加到主屏後的標題

 

複製代碼代碼如下:<meta name="apple-mobile-web-app-title" content="標題">

 

忽略數字自動識別為電話號碼

複製代碼代碼如下:<meta content="telephone=no" name="format-detection" />

 

忽略識別郵箱

 

複製代碼代碼如下:<meta content="email=no" name="format-detection" />

 

添加智能 App 廣告條 Smart App Banner:告訴瀏覽器這個網站對應的app,並在頁面上顯示下載banner(如)。參考文檔

 

複製代碼代碼如下:<meta name="apple-itunes-app" content="app-id=myAppStoreID, affiliate-data=myAffiliateData, app-argument=myURL">

 

其他 參考文檔

XML/HTML Code複製內容到剪貼簿
  1. <!-- 針對手持功能最佳化,主要是針對一些老的不識別viewport的瀏覽器,比如黑莓 -->  
  2. <meta name="HandheldFriendly" content="true">  
  3. <!-- 微軟的老式瀏覽器 -->  
  4. <meta name="MobileOptimized" content="320">  
  5. <!-- uc強制豎屏 -->  
  6. <meta name="screen-orientation" content="portrait">  
  7. <!-- QQ強制豎屏 -->  
  8. <meta name="x5-orientation" content="portrait">  
  9. <!-- UC強制全屏 -->  
  10. <meta name="full-screen" content="yes">  
  11. <!-- QQ強制全屏 -->  
  12. <meta name="x5-fullscreen" content="true">  
  13. <!-- UC應用模式 -->  
  14. <meta name="browsermode" content="application">  
  15. <!-- QQ應用模式 -->  
  16. <meta name="x5-page-mode" content="app">  
  17. <!-- windows phone 點擊無高光 -->  
  18. <meta name="msapplication-tap-highlight" content="no">  

網頁相關

申明編碼

 

複製代碼代碼如下:<meta charset=‘utf-8‘ />

 

優先使用 IE 最新版本和 Chrome

 

複製代碼代碼如下:
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<!-- 關於X-UA-Compatible -->
<meta http-equiv="X-UA-Compatible" content="IE=6" ><!-- 使用IE6 -->
<meta http-equiv="X-UA-Compatible" content="IE=7" ><!-- 使用IE7 -->
<meta http-equiv="X-UA-Compatible" content="IE=8" ><!-- 使用IE8 --> 

 

瀏覽器核心控制:國內瀏覽器很多都是雙核心(webkit和Trident),webkit核心高速瀏覽,IE核心相容網頁和舊版網站。而添加meta標籤的網站可以控制瀏覽器選擇何種核心渲染。參考文檔

 

複製代碼代碼如下:<meta name="renderer" content="webkit|ie-comp|ie-stand">



國內雙核瀏覽器預設核心模式如下:

 

1. 搜狗高速瀏覽器、QQ瀏覽器:IE核心(相容模式)
2. 360極速瀏覽器、遨遊瀏覽器:Webkit核心(極速模式)

禁止瀏覽器從本機電腦的緩衝中訪問頁面內容:這樣設定,訪問者將無法離線瀏覽。

 

複製代碼代碼如下:<meta http-equiv="Pragma" content="no-cache">

 

Windows 8

 

複製代碼代碼如下:
<meta name="msapplication-TileColor" content="#000"/> <!-- Windows 8 磁貼顏色 -->
<meta name="msapplication-TileImage" content="icon.png"/> <!-- Windows 8 磁貼表徵圖 --> 

 

網站適配:主要用於PC-手機頁的對應關係。

 

複製代碼代碼如下:
<meta name="mobile-agent"content="format=[wml|xhtml|html5]; url=url">
<!--
[wml|xhtml|html5]根據手機頁的協議語言,選擇其中一種;
url="url" 後者代表當前PC頁所對應的手機頁URL,兩者必須是一一對應關係。
--> 

 

轉碼申明:用百度開啟網頁可能會對其進行轉碼(比如貼廣告),避免轉碼可添加如下meta

 

複製代碼代碼如下:<meta http-equiv="Cache-Control" content="no-siteapp" />

<meta> 標籤

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.