-
Notifications
You must be signed in to change notification settings - Fork 0
html head
Granularly adjust the way your application interacts with search engines, browsers, and other applications with easy-to-include elements within the head
of your HTML documents.
Make a DNS handshake with a foreign domain, so the connection goes faster when the user eventually needs to access it. This works well for loading in assets (like images) from another domain, or a JavaScript library from a CDN.
<link rel="dns-prefetch" href="//example.com">
<link rel="dns-prefetch" href="//ajax.googleapis.com">
You can use as many of these as you need, but it's best if they are all immediately after the Meta Charset element (which should go right at the top of the head
), so the browser can act on them ASAP.
<meta http-equiv="x-dns-prefetch-control" content="off">
WARNING: THIS MAY MAKE YOUR SITE SLOWER IF YOU RELY ON RESOURCES FROM FOREIGN DOMAINS.
Read a lot more on our comprehensive page about DNS prefetching
<link rel="sitemap" type="application/xml" title="Sitemap" href="/sitemap.xml">
According to Heather Champ, former community manager at flickr, you should not allow search engines to index your "Contact Us" or "Complaints" page if you value your sanity. This is an HTML-centric way of achieving that.
<meta name="robots" content="noindex">
WARNING: DO NOT INCLUDE ON PAGES THAT SHOULD APPEAR IN SEARCH ENGINES.
Sites with in-site search functionality should be strongly considered for a browser search plugin. A "search plugin" is an XML file which defines how your plugin behaves in the browser. How to make a browser search plugin.
<link rel="search" title="" type="application/opensearchdescription+xml" href="">
Kill IE6's pop-up-on-mouseover toolbar for images that can interfere with certain designs and be pretty distracting in general.
<meta http-equiv="imagetoolbar" content="false">
IE10 does not support plugins, such as Flash, in Metro Mode. If your site requires plugins, you can let users know that via the X-UA-Compatible meta element, which will prompt them to switch to Desktop Mode.
<meta http-equiv="X-UA-Compatible" content="requiresActiveX=true">
Here's what it looks like alongside H5BP's default X-UA-Compatible values:
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1,requiresActiveX=true">
You can find more information in Microsoft's IEBlog post about prompting for plugin use in IE10 Metro Mode.
Enabling your application for pinning will allow IE9 users to add it to their Windows Taskbar and Start Menu. This comes with a range of new tools that you can easily configure with the elements below. See more documentation on IE9 Pinned Sites.
Without this rule, Windows will use the page title as the name for your application.
<meta name="application-name" content="Sample Title">
You know — a tooltip. A little textbox that appears when the user holds their mouse over your Pinned Site's icon.
<meta name="msapplication-tooltip" content="A description of what this site does.">
If the site should go to a specific URL when it is pinned (such as the homepage), enter it here. One idea is to send it to a special URL so you can track the number of pinned users, like so: http://www.example.com/index.html?pinned=true
<meta name="msapplication-starturl" content="http://www.example.com/index.html?pinned=true">
IE9+ will automatically use the overall color of your Pinned Site's favicon to shade its browser buttons. UNLESS you give it another color here. Only use named colors ("red") or hex colors ("#f00").
<meta name="msapplication-navbutton-color" content="#f00">
If the site should open at a certain window size once pinned, you can specify the dimensions here. It only supports static pixel dimensions. 800x600 minimum.
<meta name="msapplication-window" content="width=800;height=600">
Add Jump List Tasks that will appear when the Pinned Site's icon gets a right-click. Each Task goes to the specified URL, and gets its own mini icon (essentially a favicon, a 16x16 .ICO). You can add as many of these as you need.
<meta name="msapplication-task" content="name=Task 1;action-uri=http://host/Page1.html;icon-uri=http://host/icon1.ico">
<meta name="msapplication-task" content="name=Task 2;action-uri=http://microsoft.com/Page2.html;icon-uri=http://host/icon2.ico">
You can control the information that Facebook displays when users share your site. Below are just the most basic data points you might need. For specific content types (including "website"), see Facebook's built-in Open Graph content templates. Take full advantage of Facebook's support for complex data and activity by following the Open Graph tutorial.
<meta property="og:title" content="">
<meta property="og:description" content="">
<meta property="og:image" content="">
Signal to search engines and others "Use this URL for this page!" Useful when parameters after a #
or ?
is used to control the display state of a page. http://www.example.com/cart.html?shopping-cart-open=true
can be indexed as the cleaner, more accurate http://www.example.com/cart.html
.
<link rel="canonical" href="">
Signal to the world "This is the shortened URL to use this page!" Poorly supported at this time. Learn more by reading the article about shortlinks on the Microformats wiki.
<link rel="shortlink" href="h5bp.com">
Have an RSS feed? Link to it here. Want to learn how to write an RSS feed from scratch?
<link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml">
Atom is similar to RSS, and you might prefer to use it instead of or in addition to it. See what Atom's all about.
<link rel="alternate" type="application/atom+xml" title="Atom" href="/atom.xml">
Your server may be notified when another site links to yours. The href attribute should contain the location of your pingback service.
<link rel="pingback" href="">
- High-level explanation: http://codex.wordpress.org/Introduction_to_Blogging#Pingbacks
- Step-by-step example case: http://www.hixie.ch/specs/pingback/pingback-1.0#TOC5
- PHP pingback service: http://blog.perplexedlabs.com/2009/07/15/xmlrpc-pingbacks-using-php/
If you want, you can also add a reference to the humans.txt:
<link rel="author" href="/humans.txt">
Many thanks to Brian Blakely (Gmail: anewpage.media) for contributing most of this information