Code Monkey home page Code Monkey logo

head's Introduction

HEAD

CC0 Contributors

一份关于任何*可以*写入到你的文档中 <head> 部分的清单。

目录

最小推荐

以下是构成任何 Web 页面(网站/应用程序)的基本要素:

<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!--
  以上 3 个 meta 标签 *必须* 放在 head 之前,以确保正确的文档呈现;
  其他任何 head 元素 *必须* 在这些标签之后。
  † 如果你的项目需要支持 Internet Explorer 11 之前的版本,请使用 content="ie-edge" 标签。
-->
<title>页面标题</title>

⬆ 返回顶部

网页元素

有效的 <head> 元素包括 metalinktitlestylescriptnoscriptbase

这些元素提供了如何通过如浏览器,搜索引擎,网络爬虫等网络技术来感知和呈现文档的信息。

<!-- 设置此文档的字符编码,以便 UTF-8 范围中的所有字符(如 emoji)都能正确显示 -->
<meta charset="utf-8">

<!-- 设置文档标题 -->
<title>页面标题</title>

<!-- 设置文档中所有相对链接的基础链接 -->
<base href="https://example.com/page.html">

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

<!-- 用于文档内的 CSS -->
<style>
  /* ... */
</style>

<!-- JavaScript & No-JavaScript 标签 -->
<script>
  // function(s) go here
</script>
<noscript>
  <!--无 JS 时显示-->
</noscript>

⬆ 返回顶部

Meta 标签

<!--
  以上 3 个 meta 标签 *必须* 放在 head 之前,以确保正确的文档呈现;
  其他任何 head 元素 *必须* 在这些标签之后。
  † 如果你的项目需要支持 Internet Explorer 11 之前的版本,请使用 content="ie-edge" 标签。
-->
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge"><!-- † -->
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

<!-- 允许控制资源从何处加载。在 <head> 中尽可能地靠前放置,因为该标签仅适用于在其之后声明的资源。-->
<meta http-equiv="Content-Security-Policy" content="default-src 'self'">

<!-- Web 应用的名称(仅当网站被用作为一个应用时才使用)-->
<meta name="application-name" content="应用名称">

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

<!-- 针对页面的简短描述(限制 150 字符)-->
<!-- 此内容*可能*被用作搜索引擎结果的一部分。 -->
<meta name="description" content="一个页面描述">

<!-- 控制搜索引擎的抓取和索引行为 -->
<meta name="robots" content="index,follow"><!-- 所有搜索引擎 -->
<meta name="googlebot" content="index,follow"><!-- 仅对 Google 有效 -->

<!-- 告诉 Google 不显示网站链接的搜索框 -->
<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 -->

<!-- 确定用于构建页面的软件(如 - WordPress、Dreamweaver)-->
<meta name="generator" content="program">

<!-- 关于你的网站主题的简短描述 -->
<meta name="subject" content="你的网站主题">

<!-- 基于网站内容给出一般的年龄分级 -->
<meta name="rating" content="General">

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

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

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

<!-- 在客户端存储 cookie,web 浏览器的客户端识别 -->
<meta http-equiv="set-cookie" content="name=value; expires=date; path=url">

<!-- 指定要显示在一个特定框架中的页面 -->
<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): 可选; 如 content="US" / content="US-NY" -->
<meta name="geo.placename" content="city/town"><!-- 如 content="New York City" -->

⬆ 返回顶部

链接

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

<!-- 有助于防止出现内容重复的问题 -->
<link rel="canonical" href="http://example.com/article/?page=2">

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

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

<!-- 链接到关于页面所有者的信息 -->
<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:[email protected]">
<link rel="me" href="sms:+15035550125">

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

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

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

<!-- 分别是一系列页面中的第一个,最后一个,上一个和下一个页面 -->
<link rel="first" href="http://example.com/article/">
<link rel="last" href="http://example.com/article/?page=42">
<link rel="prev" href="http://example.com/article/?page=1">
<link rel="next" href="http://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 时通知它 -->
<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">

<!-- 预取,预载,预浏览 -->
<!-- 更多信息: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">

⬆ 返回顶部

网站图标

<!-- 针对 IE 10 及以下版本 -->
<!-- 如果将 `favicon.ico` 放在根目录下,则无需标签 -->

<!-- 我们目前需要提供的最大的网站图标尺寸 -->
<link rel="icon" sizes="192x192" href="/path/to/icon.png">

<!-- Apple 触摸图标 (尺寸同样是 192x192) -->
<link rel="apple-touch-icon" href="/path/to/apple-touch-icon.png">

<!-- Safari 固定选项卡图标 -->
<link rel="mask-icon" href="/path/to/icon.svg" color="blue">

⬆ 返回顶部

社交

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: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">

Twitter Privacy

如果你在自己的网站中嵌入了推文,Twitter 可以使用你网站上的信息为 Twitter 用户定制内容和建议。 更多关于 Twitter 隐私选项的信息.

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

Google+ / Schema.org

<html lang="" itemscope itemtype="http://schema.org/Article">
<link rel="author" href="">
<link rel="publisher" href="">
<meta itemprop="name" content="内容标题">
<meta itemprop="description" content="内容描述少于 200 个字符">
<meta itemprop="image" content="http://example.com/image.jpg">

注意: 这个标记需要将属性添加到你的顶级 html 标签中

Pinterest

根据他们的帮助中心可知,Pinterest 允许你禁止他人保存你网站里的内容。description 为可选。

<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 版网址 -->
<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">

⬆ 返回顶部

浏览器 / 平台

Apple iOS

<!-- 智能应用 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">

<!-- 添加到主屏幕 -->
<!-- 启动图标 (大于等于 180x180px) -->
<link rel="apple-touch-icon" href="/path/to/apple-touch-icon.png">

<!-- 启动屏幕图片 -->
<link rel="apple-touch-startup-image" href="/path/to/launch.png">

<!-- 启动图标的标题 -->
<meta name="apple-mobile-web-app-title" content="应用标题">

<!-- 启用独立(全屏)模式 -->
<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 -->

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">

<!-- IE10: 禁用链接点击高亮 (https://blogs.windows.com/buildingapps/2012/11/15/adapting-your-webkit-optimized-site-for-internet-explorer-10/) -->
<meta name="msapplication-tap-highlight" content="no">

<!-- 固定网站 (https://msdn.microsoft.com/en-us/library/dn255024(v=vs.85).aspx) -->
<meta name="application-name" content="Sample Title">
<meta name="msapplication-tooltip" content="A description of what this site does.">
<meta name="msapplication-starturl" content="https://example.com/index.html?pinned=true">
<meta name="msapplication-navbutton-color" content="#FF3300">
<meta name="msapplication-window" content="width=800;height=600">
<meta name="msapplication-task" content="name=Task 1;action-uri=https://host/Page1.html;icon-uri=https://host/icon1.ico">
<meta name="msapplication-task" content="name=Task 2;action-uri=https://microsoft.com/Page2.html;icon-uri=https://host/icon2.ico">
<meta name="msapplication-badge" value="frequency=NUMBER_IN_MINUTES;polling-uri=https://example.com/path/to/file.xml">
<meta name="msapplication-TileColor" content="#FF3300">
<meta name="msapplication-TileImage" content="path/to/tileimage.jpg">

<meta name="msapplication-config" content="https://example.com/browserconfig.xml">
<meta name="msapplication-notification" content="frequency=60;polling-uri=https://example.com/livetile;polling-uri2=https://example.com/livetile2">
<meta name="msapplication-task-separator" content="1">

⬆ 返回顶部

国内的浏览器

360 浏览器

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

QQ 移动浏览器

<!-- 在指定方向上锁定屏幕(锁定横/竖屏) -->
<meta name="x5-orientation" content="landscape/portrait">
<!-- 全屏显示此页面 -->
<meta name="x5-fullscreen" content="true">
<!-- 页面将以“应用模式”显示(全屏等)-->
<meta name="x5-page-mode" content="app">

UC 移动浏览器

<!-- 在指定方向上锁定屏幕(锁定横/竖屏) -->
<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">

⬆ 返回顶部

应用链接

<!-- 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">

<!-- 页面回退 -->
<meta property="al:web:url" content="https://applinks.org/documentation">

⬆ 返回顶部

其他资源

⬆ 返回顶部

相关项目

⬆ 返回顶部

其他格式

⬆ 返回顶部

翻译

⬆ 返回顶部

贡献

开启一个 issue 或一个 pull 请求来提出修改或补充。

指南

** HEAD ** 仓库由两个分支组成:

1、master

对该分支包含的 README.md 文件的修改会自动反映在 gethead.info 网站上。 所有对照表内容的更改都应该针对此文件。

请按照下列步骤 pull 请求:

  • 只修改一个标签,或一次一组相关的标签
  • 对属性使用双引号
  • 请不要在自我闭合的元素中使用斜线 —— 即便 HTML5 规范中说,他们是可选的
  • 考虑在文档中加入链接以支持你所提到的变化

2. gh-pages

该分支负责 gethead.info 网站。我们使用 Jekyll 通过 GitHub Pages 服务来部署 README.md Markdown 文件。所有网站相关的修改必须集中在这里。

你可能需要通过 Jekyll 文档 来了解 Jekyll 是如何在该分支上工作的。

贡献者

列出所有超级棒的 贡献者们.

作者

Josh Buchea

翻译者

子丶言

协议

CC0

⬆ 返回顶部

head's People

Contributors

amery2010 avatar beeva-miguelsarries avatar cryogenic-ric avatar gidgidonihah avatar hemanth avatar jakemckown avatar jasonkarns avatar jonsuh avatar jordanbrauer avatar joshbuchea avatar joshuahess avatar joshuahiggins avatar justmarkup avatar khaosdoctor avatar konfuze avatar ktquez avatar marcobiedermann avatar mastermay avatar ngyikp avatar pmacey avatar safaring avatar saijogeorge avatar sarbbottam avatar scottaohara avatar thatchej avatar tibor avatar tomlutzenberger avatar widyakumara avatar ylc395 avatar zoro-santana avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.