Meta element

from Wikipedia, the free encyclopedia

The meta element (unspecific or incorrectly often referred to as a meta tag ) is used in HTML or XHTML documents to specify metadata . It is noted as an empty element within the headelement.

General

The metadata is headnoted in the header of an HTML document, i.e. in the element.

There are various metadata schemes, some of which are developed by institutions or committees (for example Dublin Core ), but there are also wild types such as entries in the producer software (for example manufacturer and version). Very little of this meta information is interpreted by user agents (e.g. browsers or search robots ). As with all HTML elements, compliance by the user agent depends on the capabilities and configuration of the same.

The main purpose of metadata is to improve the searchability of the World Wide Web or an individual website . In addition, special instructions for controlling the search robots of search engines can be noted with the help of metadata . Metadata was once considered a secret weapon in order to be listed as high as possible on a search engine. The metadata has therefore long been misused to specify misleading keywords (see keyword stuffing ). In the meantime, search engines are again placing more emphasis on the actual text content of a website, which the reader also perceives in the browser, and largely ignore meta information or no longer allow it to flow into the ranking of the page.

There are countless “meta tag generators ” on the web, but they mostly work with outdated or inflexible compilations of meta information and are therefore only suitable for a few applications.

Examples

The following code examples use XML-compatible syntax - in the case of HTML 4.01, however, the element must not be closed with a slash.

Page Description

<meta name="description" content="Lorem ipsum dolor sit amet, consetetur sadipscing elitr." />

Brief description or abstract of the content of the website.

Keywords

<meta name="keywords" content="Stichwort 1, Stichwort 2, Stichwort 3" />

Names keywords or topics that appear or are dealt with on the website. The keywords are separated from each other by commas; to improve human readability, a space is often inserted after the comma.

author

<meta name="author" content="Autorenname" />

Name of the author and therefore responsible for the content.

Instructions for web crawlers

<meta name="robots" content="index,follow" />

Alternatively:

<meta name="robots" content="all" />

can be used or the code can be omitted entirely.

The web crawler (search robot) should explicitly include the website in the search engine index so that it can be found and follow the hyperlinks on the page. This information is generally unnecessary as it corresponds to the normal behavior of most web crawlers.

<meta name="robots" content="noindex" />

The search robot should not include the website in the index. The website should therefore not be findable via search engines. See also: Robots Exclusion Standard .

<meta name="robots" content="nofollow" />

The search robot is allowed to pick up the website, but should not follow the hyperlinks on the page. The effect is as if the links on the relevant page do not exist. The same effect can also be achieved for individual links by adding the attribute rel="nofollow"to them. (see nofollow )

<meta name="robots" content="noodp" />

The search engine should not use the description texts of the Open Directory Project on the results page - provided the page is entered there - but rather display a section of the page itself (so-called "snippet") , as with URLs that have not been entered . This instruction is supported by Google and MSN Search .

<meta name="robots" content="noydir" />

The search engine should not use the descriptive texts from the Yahoo directory on the results page - if the page is entered there - but rather a section of the page itself , as with URLs that are not entered . This instruction is only supported by Yahoo (Robot: Slurp).

Equivalents to HTTP header data

Meta elements can contain information that is also transmitted in headers of HTTP communication from the server to the client (e.g. a web browser ). The data can be read from the web server before the HTTP response is generated and incorporated into the headers. If information is contained in the HTTP header, this is to be preferred to any different information in a meta element of the client.

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

Specification of the MIME type (in the example text / html) and the character encoding used (in the example UTF-8 ) of the document.

Cache control

Web pages are cached on proxy servers or in the browser cache for fast Internet operation. This will make them load faster on subsequent calls. To prevent this process, the meta tag "cache-control" with the value "no-cache" is used.

<meta http-equiv="cache-control" content="no-cache" />

If a website is provided with this meta tag, it must be reloaded from the web server each time the page is accessed. On the one hand, this can slow down page retrieval, but on the other hand, it can be useful if the website has continuously changing content.

Expires

With the attribute “http-equiv” and the value “expires”, an expiry time can be defined for the retrieved HTML data - instead of completely preventing the temporary storage.

<meta http-equiv="expires" content="Verfallszeitpunkt in Sekunden" />

Forwarding through "refresh"

To one side to another URL in the call forwarding (Engl. Forwarding ) that can refreshvalue be used. The content-attribute can be used to set a time until the forwarding takes place, e.g. B. to point out the reason for the forwarding to the user:

<meta http-equiv="refresh" content="5; URL=http://www.example.org/" />

Other Information

See also

Web links

Individual evidence

  1. Jens Meiert: Elements, Tags and Attributes
  2. a b HTML 4.01 Specification: The global structure of an HTML document - The META element
  3. a b An overview of the most important meta tags . 1und1.de/digitalguide. Retrieved July 27, 2017.