HTML and CSS Reference
In-Depth Information
actually searching for—that search engines now largely ignore keywords in
meta
elements, and keywords
have no impact on where a page will rank in the search results for a given term.
Even so,
meta
keywords may still be marginally beneficial to search engines and searchers. If you're going
to include keywords in a
meta
element, keep the list reasonably short and make sure the terms are
actually relevant to the contents of the page. You can also get along just fine without
meta
keywords at all;
the search engines will still find you.
Including a
meta
description is much more useful than keywords because it will often appear in search
engine results alongside the page title and URL. The description should be a very brief summary of the
page's contents, or the introduction to an article, if that's the main content of the page. A site's home page
might bear a description of the entire website whereas individual pages within the site should have more
specific descriptions for each individual page.
Search engines exist to help people find content, so the very best advice is simply to provide content
people will want to find. Good metadata can help nudge the search engine robots in the right direction, but
it's the readable content of your page that really matters. Build your web pages for humans, not for robots.
Attributes
The
meta
element typically requires a
content
attribute in combination with either a
name
or
http-equiv
attribute. An exception is the
charset
attribute, which doesn't require the presence of a
content
attribute.
charset
: The document's character encoding set, usually UTF-8 unless you specifically need an
alternative encoding (which usually depends on your content's natural language).
content
: The metadata value, paired with either a
name
or
http-equiv
attribute.
http-equiv
: A pragma directive, equivalent to an HTTP header typically passed to the browser
from the server. This attribute specifies the particular metadata declared while the
content
attribute specifies the value.
name
: Arbitrary document-level metadata applying to the entire document, or special instructions
for user-agents. This attribute specifies the particular metadata declared while the
content
attribute specifies the value.
link
The
link
element associates the current document with an external resource. The required
rel
attribute
indicates the relationship between the current document and the linked resource, and the required
href
attribute carries the linked resource's URL. This is a void element with no text content and no end tag, and
it can only appear within the
head
element.
The
link
element's most common duty is to connect a web page to an external style sheet, but it can also
connect the document to alternative versions, specify an alternate URL for the page, associate the page
with an icon that browsers can display in bookmarks and the address field, and more.
This element requires a
rel
attribute, with its value being a space-separated list of predefined keywords
that indicate the relationship between the current document and the linked resource, thus also indicating