til
  • README
  • Software Development Roles
  • solid
  • README
    • service-worker
  • docker
    • arg
    • 更新docker版本
  • editor
    • vscode
    • Creating a VS Code Theme
  • english
    • words
  • front-end
    • ==
    • ECMAScript
    • IIFE
    • Label
    • basic
    • html.js.css渲染顺序
    • npm-vs-yarn
    • obj-delete-key-value
    • react
    • split-join-and-replace
    • video
    • 前端自检清单
    • 递归及去重
    • css
      • css换肤
      • flex
      • list
      • nth-child和nth-of-type区别
      • padding
      • position
      • 层叠上下文
      • 层叠样式(+)
      • 正方形
      • 语义化标签
    • dom
      • DOCTYPE
      • HEAD
      • 修改document
      • 自定义表单验证
    • electron
      • basic
    • es6
      • basic-type
      • basic
      • prototype-example
      • defineProperty
      • understanding-es6
        • 0.introduction
        • Appendix A: Smaller Changes
        • Appendix B: Understanding ES7
        • Block-Binding
        • Proxies&Reflection
        • class
        • 解构赋值
        • function
        • improved-array
        • iterators&generators
        • modules
        • object
        • promise
        • Map&Set
        • symbol
    • images
      • 前端角度看图片
    • interview_case
      • lexical_scope
      • redux和localstroage存储位置
    • javascript
      • fuck-the-js
      • js-engine-work
      • js原生操作dom
      • what-is-function-program
      • 执行上下文
      • articles
        • JavaScript中使用函数组合
        • JavaScript中的依赖注入
        • JavaScript作用域链中的标识符解析和闭包
        • JavaScript是何如工作的--概述
        • JavaScript深拷贝
        • JavaScript的全局变量是如何工作的
        • js继承常见的误解
        • node12&chrome中7个新的提案功能
        • 你真的懂JavaScript吗
      • date
        • index
      • engines
        • basic
        • JavaScript引擎基础:外形和内联缓存
        • v8中推测性优化的介绍
        • 优化原型
        • 更快的异步功能和promise
      • events
        • baisc
        • 事件冒泡和捕获
        • 定义事件
        • 页面生命周期
      • higher-order-function
        • curry
        • monad
      • module
        • basic
        • main&module
      • objects
        • iterator
        • spread
        • examples
          • iterator
      • performance
        • blocking-css
        • cache
      • prototype
        • Property-Descriptors
        • basic
        • prototype-shadow
      • you-dont-known-js
        • async&performance
          • Chapter 1: Asynchrony: Now & Later
          • Chapter 2: Callbacks
          • Chapter 3: Promises
          • Chapter 4: Generators
        • scope & closures
          • apA
          • apB
          • apC
          • apD
          • chapter1-what-is-scope
          • chapter2-lexical-scope
          • chapter3-function-vs-block-scope
          • chapter4-hoisting
          • chapter5-scope-closure
        • this & object prototypes
          • chapter1-this-or-that
          • chapter2-this-make-sense
          • chapter3-objects
          • chapter4-mixing(up)-class-object
          • chapter5-prototype
          • chapter6-behavior-delegation
        • types&grammer
          • Chapter1-Types
          • Chapter2-Values
          • Chapter3-Natives
          • Chapter4-coercion
          • Chapter5-grammer
        • up & going
          • chapter1-into-programming
          • chapter2-into-javascript
          • chapter3-into-YDKJS
    • mobile
      • iPhone分辨率终极指南
    • npm
      • arguments
      • build
    • react-native
      • prop-methods
    • react
      • PropTypes
      • basic
      • codebase-overview
      • component-element-instance
      • context
      • how-to-known-component-is-func-or-class
      • overview
      • react16.9
      • react18计划
      • react的设计原则
      • reconciliation
      • setState
      • useMemo
      • why-do-we-write-super-props
      • 从头实现一个react
      • concurrent
        • 引入并发模式(仅试验)
      • conf
        • conf-2019
      • events
        • 合成事件概述
      • hooks
        • custom-hook
        • effect-hook
        • hooks-api
        • intro
        • overview
        • rules
        • state-hook
        • hooks-vs-class
          • thinking-in-react-hooks
      • overreact
        • Development模式是如何工作的
        • How-Does-setState-Know-What-to-Do
        • Why-Do-React-Elements-Have-a-$$typeof-Property
        • Why-Do-React-Hooks-Rely-on-Call-Order
        • how-to-known-component-is-func-or-class
        • preparing-tach-talk-motivation
        • react作为ui运行
        • things-i-dont-known-as-2018
        • ui-element-problem-and-build-yourself
        • why-do-we-write-super-props
        • 一份完整的useEffect指南
        • 为什么X不是Hook
        • 函数组件与类有什么不同?
        • 演讲准备2-what-why-how
        • 编写弹性组件
        • 让setInterval在React-Hooks中为声明式
      • practice
        • render
      • react-dom
        • basic
      • react-redux
        • apiv7.1-hooks
        • connect
        • shallow-equal
      • redux
        • applyMiddleware
        • applyMiddleware2-细节
        • example
    • regex
      • index
    • stories
      • 数组下标
      • 阻止事件冒泡
    • svelte
      • compile-svelte-in-your-head-1
      • compiler-overview
      • parser
        • 写一个解析器-JavaScript的JSON解析器
    • turbopack
      • basic
    • typescript
      • interface和type的区别
    • webpack
      • hash
      • webpack4-for-react
      • webpack4
      • webpack4to5
      • babel
        • babel-parser和acorn的区别
        • babel.7.11
        • family
        • react16.14使用new-transform
        • update-to-7
    • pdf
      • deep-js
        • basic
      • react
        • reintroducing
  • git
    • capital
    • emoji
  • http
    • http2.0
    • response
  • rails
    • api
    • flash
    • middleware-vs-metal
    • model
    • performance
    • routes
    • environment
      • error
    • patterns
      • service
    • sidekiq
      • params
    • deploy
      • capistrano
        • ssh
  • ruby
    • self
    • net
      • http请求携带cookie
  • server
    • ss
    • ssh
    • user
    • crawler
      • puppeteer
    • nginx
      • domain-without-80
      • nginx节省带宽
  • sql
    • rails
    • search
Powered by GitBook
On this page
  • 目录
  • 最低要求
  • Elements
  • Meta
  • Link
  • Icons
  • Social
  • Facebook Open Graph
  • Twitter Card
  • Twitter Privacy
  • Schema.org
  • Pinterest
  • Facebook Instant Articles
  • OEmbed
  • Browsers / Platforms
  • Apple iOS
  • Google Android
  • Google Chrome
  • Microsoft Internet Explorer
  • Browsers (Chinese)
  • 360 Browser
  • QQ Mobile Browser
  • UC Mobile Browser
  • App Links
  • 其他资源
  • 相关项目
  • 其他格式
  • 作者
  • 原文
  1. front-end
  2. dom

HEAD

PreviousDOCTYPENext修改document

Last updated 5 years ago

一个所有有可能进入document <head>的列表。

目录

最低要求

以下是任何网络文件(网站/应用程序)的基本要素:

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!--
  上面的两个 meta 标签 *必须* 首先出现在<head>里,
  他始终如一地确保document渲染。
  任何其他head元素都应该在这些标签后面。
 -->
<title>Page Title</title>

Elements

有效的<head>元素包含meta, link, title, style, script, noscript, 和base。

这些元素提供了有关如何通过Web技术感知和呈现document的信息。例如浏览器,搜索引擎,机器人等。

<!--
  设置此document的字符编码,以便正确呈现UTF-8空间内的所有字符(如emoji)。
-->
<meta charset="utf-8">

<!-- 设置document的title -->
<title>Page Title</title>

<!-- 设置document中所有相对URL的基本URL -->
<base href="https://example.com/page.html">

<!-- 链接到外部CSS文件 -->
<link rel="stylesheet" href="styles.css">

<!-- 用于在文档内添加CSS -->
<style>
  /* ... */
</style>

<!-- JavaScript & No-JavaScript 标签 -->
<script src="script.js"></script>
<script>
  // 函数在这里
</script>
<noscript>
  <!-- 没有js的替代品 -->
</noscript>

Meta

<!--
  紧跟的两个 meta 标签 *必须* 首先出现在<head>里,
  他始终如一地确保document渲染。
  任何其他head元素都应该在这些标签后面。
-->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">

<!--
  允许控制加载资源的位置。
  尽可能早的放在<head>里, 因为标记只应用于在它之后声明的资源。
-->
<meta http-equiv="Content-Security-Policy" content="default-src 'self'">

<!-- web应用程序名称(仅当网站作为应用程序(app)使用时才应使用) -->
<meta name="application-name" content="Application Name">

<!-- 适用于Chrome,Firefox OS和Opera的主题颜色 -->
<meta name="theme-color" content="#4285f4">

<!-- document的简短描述(限制为150个字符) -->
<!-- 此内容*可以*用作搜索引擎结果的一部分。 -->
<meta name="description" content="A description of the page">

<!-- 控制搜索引擎爬虫和索引的行为 -->
<meta name="robots" content="index,follow"><!-- 所有的搜索引擎 -->
<meta name="googlebot" content="index,follow"><!-- 特定于谷歌 -->

<!-- 告诉谷歌不要显示站点链接搜索框 -->
<meta name="google" content="nositelinkssearchbox">

<!-- 告知Google不要为此文档提供翻译 -->
<meta name="google" content="notranslate">

<!-- 验证网站的所有权 -->
<meta name="google-site-verification" content="verification_token"><!-- Google Search Console -->
<meta name="yandex-verification" content="verification_token"><!-- Yandex Webmasters -->
<meta name="msvalidate.01" content="verification_token"><!-- Bing Webmaster Center -->
<meta name="alexaVerifyID" content="verification_token"><!-- Alexa Console -->
<meta name="p:domain_verify" content="code_from_pinterest"><!-- Pinterest Console-->
<meta name="norton-safeweb-site-verification" content="norton_code"><!-- Norton Safe Web -->

<!-- 识别用于构建document的软件(即- WordPress, Dreamweaver) -->
<meta name="generator" content="program">

<!-- 对文档主题的简短描述 -->
<meta name="subject" content="your document's subject">

<!-- 根据文档内容给出相对的年龄段评级 -->
<!-- 译:参考这里 https://www.metatags.org/meta_name_rating  -->
<meta name="rating" content="General">

<!-- 允许控制如何传递引用者信息 -->
<meta name="referrer" content="no-referrer">

<!-- 尽可能的禁用自动检测和格式化电话号码 -->
<meta name="format-detection" content="telephone=no">

<!-- 通过设置为"off"完全退出DNS prefetching -->
<meta http-equiv="x-dns-prefetch-control" content="off">

<!-- 指定要在特定frame中显示的document -->
<meta http-equiv="Window-Target" content="_value">

<!-- 地理标记 -->
<meta name="ICBM" content="latitude, longitude">
<meta name="geo.position" content="latitude;longitude">
<meta name="geo.region" content="country[-state]"><!-- 国家代码 (ISO 3166-1): 强制性的, 州代码 (ISO 3166-2): 可选的; eg. content="US" / content="US-NY" -->
<meta name="geo.placename" content="city/town"><!-- eg. content="New York City" -->

Link

<!-- 指向外部样式表 -->
<link rel="stylesheet" href="https://example.com/styles.css">

<!-- 有助于防止搜索引擎优化中出现重复的内容问题 -->
<!-- 译:参考 https://en.wikipedia.org/wiki/Canonical_link_element -->
<link rel="canonical" href="https://example.com/article/?page=2">

<!-- 链接到当前document的AMP HTML版本 -->
<link rel="amphtml" href="https://example.com/path/to/amp-version.html">

<!-- 指向JSON文件的链接,该文件指定Web应用程序的“安装”凭据 -->
<link rel="manifest" href="manifest.json">

<!-- 链接到document有关作者的信息 -->
<link rel="author" href="humans.txt">

<!-- 引用适用于链接上下文的版权声明 -->
<link rel="license" href="copyright.html">

<!-- 提供对文档中可能使用其他语言的位置的引用 -->
<link rel="alternate" href="https://es.example.com/" hreflang="es">

<!-- 提供有关作者或其他人的信息 -->
<link rel="me" href="https://google.com/profiles/thenextweb" type="text/html">
<link rel="me" href="mailto:name@example.com">
<link rel="me" href="sms:+15035550125">

<!-- 指向描述一组记录、文档或其他具有历史意义的材料的文档的链接 -->
<link rel="archives" href="https://example.com/archives/">

<!-- 链接到层次结构中的顶级资源 -->
<link rel="index" href="https://example.com/article/">

<!-- 提供一个自引用——当文档有多个可能的引用时非常有用-->
<link rel="self" type="application/atom+xml" href="https://example.com/atom.xml">

<!-- 分别是一系列文档中的第一个、最后一个、前一个和下一个文档 -->
<link rel="first" href="https://example.com/article/">
<link rel="last" href="https://example.com/article/?page=42">
<link rel="prev" href="https://example.com/article/?page=1">
<link rel="next" href="https://example.com/article/?page=3">

<!-- 当使用第三方服务维护博客时使用 -->
<link rel="EditURI" href="https://example.com/xmlrpc.php?rsd" type="application/rsd+xml" title="RSD">

<!-- 当另一个WordPress博客链接到您的WordPress博客或文章时,生成一个自动评论 -->
<link rel="pingback" href="https://example.com/xmlrpc.php">

<!-- 在文档上链接到URL时通知此URL -->
<link rel="webmention" href="https://example.com/webmention">

<!-- 启用使用Micropub客户端发布到你自己的域 -->
<link rel="micropub" href="https://example.com/micropub">

<!-- 打开搜索 -->
<link rel="search" href="/open-search.xml" type="application/opensearchdescription+xml" title="Search Title">

<!-- Feeds -->
<link rel="alternate" href="https://feeds.feedburner.com/example" type="application/rss+xml" title="RSS">
<link rel="alternate" href="https://example.com/feed.atom" type="application/atom+xml" title="Atom 0.3">

<!-- Prefetching, preloading, prebrowsing -->
<!-- 更多信息: https://css-tricks.com/prefetching-preloading-prebrowsing/ -->
<link rel="dns-prefetch" href="//example.com/">
<link rel="preconnect" href="https://www.example.com/">
<link rel="prefetch" href="https://www.example.com/">
<link rel="prerender" href="https://example.com/">
<link rel="preload" href="image.png" as="image">

Icons

<!-- 用于 IE 10 和 更低的 -->
<!-- 将favicon.ico放在根目录中——不需要标记 -->

<!-- 我们需要它的最高分辨率的图标 -->
<link rel="icon" sizes="192x192" href="/path/to/icon.png">

<!-- Apple Touch Icon (reuse 192px icon.png) -->
<link rel="apple-touch-icon" href="/path/to/apple-touch-icon.png">

<!-- Safari Pinned Tab Icon -->
<link rel="mask-icon" href="/path/to/icon.svg" color="blue">

Social

Facebook Open Graph

<meta property="fb:app_id" content="123456789">
<meta property="og:url" content="https://example.com/page.html">
<meta property="og:type" content="website">
<meta property="og:title" content="Content Title">
<meta property="og:image" content="https://example.com/image.jpg">
<meta property="og:image:alt" content="A description of what is in the image (not a caption)">
<meta property="og:description" content="Description Here">
<meta property="og:site_name" content="Site Name">
<meta property="og:locale" content="en_US">
<meta property="article:author" content="">

Twitter Card

<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@site_account">
<meta name="twitter:creator" content="@individual_account">
<meta name="twitter:url" content="https://example.com/page.html">
<meta name="twitter:title" content="Content Title">
<meta name="twitter:description" content="Content description less than 200 characters">
<meta name="twitter:image" content="https://example.com/image.jpg">
<meta name="twitter:image:alt" content="A text description of the image conveying the essential nature of an image to users who are visually impaired. Maximum 420 characters.">

Twitter Privacy

<!-- 禁止Twitter将你的网站信息用于个性化目的 -->
<meta name="twitter:dnt" content="on">

Schema.org

<html lang="" itemscope itemtype="https://schema.org/Article">
    <head>
      <link rel="author" href="">
      <link rel="publisher" href="">
      <meta itemprop="name" content="Content Title">
      <meta itemprop="description" content="Content description less than 200 characters">
      <meta itemprop="image" content="https://example.com/image.jpg">

注意: 这些元标记需要将itemscope和itemtype属性添加到<html>标记中。

Pinterest

<meta name="pinterest" content="nopin" description="Sorry, you can't save from my website!">

Facebook Instant Articles

<meta charset="utf-8">
<meta property="op:markup_version" content="v1.0">

<!-- 你文章的web版的网址(URL) -->
<link rel="canonical" href="https://example.com/article.html">

<!-- 用于这篇文章的样式 -->
<meta property="fb:article_style" content="myarticlestyle">

OEmbed

<link rel="alternate" type="application/json+oembed"
  href="https://example.com/services/oembed?url=http%3A%2F%2Fexample.com%2Ffoo%2F&amp;format=json"
  title="oEmbed Profile: JSON">
<link rel="alternate" type="text/xml+oembed"
  href="https://example.com/services/oembed?url=http%3A%2F%2Fexample.com%2Ffoo%2F&amp;format=xml"
  title="oEmbed Profile: XML">

Browsers / Platforms

Apple iOS

<!-- Smart App Banner -->
<meta name="apple-itunes-app" content="app-id=APP_ID,affiliate-data=AFFILIATE_ID,app-argument=SOME_TEXT">

<!-- 尽可能的禁用自动检测和格式化电话号码 -->
<meta name="format-detection" content="telephone=no">

<!-- Launch Icon (180x180px or larger) -->
<link rel="apple-touch-icon" href="/path/to/apple-touch-icon.png">

<!-- Launch Screen Image -->
<link rel="apple-touch-startup-image" href="/path/to/launch.png">

<!-- Launch Icon Title -->
<meta name="apple-mobile-web-app-title" content="App Title">

<!-- 启用独立(全屏)模式 -->
<meta name="apple-mobile-web-app-capable" content="yes">

<!-- 状态栏外观(除非启用独立模式,否则没有效果) -->
<meta name="apple-mobile-web-app-status-bar-style" content="black">

<!-- iOS应用深度链接 -->
<meta name="apple-itunes-app" content="app-id=APP-ID, app-argument=http/url-sample.com">
<link rel="alternate" href="ios-app://APP-ID/http/url-sample.com">

Google Android

<meta name="theme-color" content="#E64545">

<!-- 添加到主屏幕 -->
<meta name="mobile-web-app-capable" content="yes">
<!-- 更多信息: https://developer.chrome.com/multidevice/android/installtohomescreen -->

<!-- Android应用深层链接 -->
<meta name="google-play-app" content="app-id=package-name">
<link rel="alternate" href="android-app://package-name/http/url-sample.com">

Google Chrome

<link rel="chrome-webstore-item" href="https://chrome.google.com/webstore/detail/APP_ID">

<!-- 禁用翻译提示 -->
<meta name="google" content="notranslate">

Microsoft Internet Explorer

<!-- 强制IE 8/9/10使用其最新的渲染引擎 -->
<meta http-equiv="x-ua-compatible" content="ie=edge">

<!-- 通过Skype Toolbar浏览器扩展尽可能禁用自动检测和格式化电话号码 -->
<meta name="skype_toolbar" content="skype_toolbar_parser_compatible">

<!-- Windows Tiles -->
<meta name="msapplication-config" content="/browserconfig.xml">

用于browserconfig.xml的xml标记的最低要求:

<?xml version="1.0" encoding="utf-8"?>
<browserconfig>
   <msapplication>
     <tile>
        <square70x70logo src="small.png"/>
        <square150x150logo src="medium.png"/>
        <wide310x150logo src="wide.png"/>
        <square310x310logo src="large.png"/>
     </tile>
   </msapplication>
</browserconfig>

Browsers (Chinese)

360 Browser

<!-- 选择渲染引擎顺序 -->
<meta name="renderer" content="webkit|ie-comp|ie-stand">

QQ Mobile Browser

<!-- 锁定屏幕到指定的方向 -->
<meta name="x5-orientation" content="landscape/portrait">

<!-- 全屏显示此文档 -->
<meta name="x5-fullscreen" content="true">

<!-- 文档将以"应用模式"(全屏等)显示 -->
<meta name="x5-page-mode" content="app">

UC Mobile Browser

<!-- 锁定屏幕到指定的方向 -->
<meta name="screen-orientation" content="landscape/portrait">

<!-- 全屏显示此文档 -->
<meta name="full-screen" content="yes">

<!-- 即使在"文本模式"下,UC浏览器也会显示图像 -->
<meta name="imagemode" content="force">

<!-- 文档将以"应用模式"显示(全屏、禁止手势等) -->
<meta name="browsermode" content="application">

<!-- 对此文档禁用UC浏览器"夜间模式" -->
<meta name="nightmode" content="disable">

<!-- 简化文档以减少数据传输 -->
<meta name="layoutmode" content="fitscreen">

<!-- 禁用UC浏览器的功能"当本文档中有多个单词时缩放字体" -->
<meta name="wap-font-scale" content="no">

App Links

<!-- iOS -->
<meta property="al:ios:url" content="applinks://docs">
<meta property="al:ios:app_store_id" content="12345">
<meta property="al:ios:app_name" content="App Links">

<!-- Android -->
<meta property="al:android:url" content="applinks://docs">
<meta property="al:android:app_name" content="App Links">
<meta property="al:android:package" content="org.applinks">

<!-- Web fall back -->
<meta property="al:web:url" content="https://applinks.org/documentation">

其他资源

相关项目

其他格式

作者

  • 原著

  • 译者

原文

📖

📖

📖

📖

📖

📖

📖

📖

📖

📖

📖

🛠 使用 测试你的页面

📖

🛠 使用 测试你的页面

如果你在网站中嵌入推文,Twitter可以使用你网站上的信息来定制Twitter用户的内容和建议。

🛠使用测试你的页面

根据,Pinterest可以防止人们从你的网站上保存内容。description是可选的。

📖

📖

📖

📖

📖

📖

📖

📖

📖

- HEAD片段的Atom包

- HEAD片段的Sublime Text包

- HEAD代码段的CLI接口

- 操作Vue.js的HEAD标签的meta信息

📄

Meta tags that Google understands
WHATWG Wiki: MetaExtensions
ICBM on Wikipedia
Geotagging on Wikipedia
Link Relations
All About Favicons (And Touch Icons)
Creating Pinned Tab Icons
Favicon Cheat Sheet
Icons & Browser Colors
Facebook Open Graph Markup
Open Graph protocol
Facebook Sharing Debugger
Getting started with cards — Twitter Developers
Twitter Card Validator
更多关于Twitter隐私选项。
结构化数据测试工具
他们的帮助中心
Creating Articles - Instant Articles
Code Samples - Instant Articles
oEmbed format
Configuring Web Applications
Browser configuration schema reference
UC Browser Docs
App Links
HTML5 Boilerplate Docs: The HTML
HTML5 Boilerplate Docs: Extend and customize
Atom HTML Head Snippets
Sublime Text HTML Head Snippets
head-it
vue-head
PDF
Josh
xiaohesong
https://github.com/joshbuchea/HEAD
最低要求
elements
Meta
Link
Icons
Social
Facebook Open Graph
Twitter Card
Twitter Privacy
Schema.org
Pinterest
Facebook Instant Articles
OEmbed
Browsers / Platforms
Apple iOS
Google Android
Google Chrome
Microsoft Internet Explorer
Browsers (Chinese)
360 Browser
QQ Mobile Browser
UC Mobile Browser
App Links
其他资源
相关项目
其他格式
作者
原文
⬆ 返回顶部
⬆ 返回顶部
⬆ 返回顶部
⬆ 返回顶部
⬆ 返回顶部
⬆ 返回顶部
⬆ 返回顶部
⬆ 返回顶部
⬆ 返回顶部
⬆ 返回顶部
⬆ 返回顶部