Meta теги html lang

Метатеги и атрибуты, которые распознаются роботами Google

Из этой статьи вы узнаете, что такое метатеги, какие метатеги и HTML-атрибуты распознаются роботами Google при сканировании и индексировании сайтов, а также другую полезную информацию, которая поможет вам внедрить метатеги на свой сайт.

Теги meta

Метатеги – это HTML-теги, предназначенные для предоставления поисковым системам и другим клиентам дополнительной информации о веб-странице. Если клиент не способен обработать определенные метатеги, он просто проигнорирует их. Метатеги добавляются в раздел HTML-кода и обычно выглядят так:

Google поддерживает следующие теги meta :

Если вы пользуетесь системой управления контентом (например, Wix, WordPress или Blogger), вероятно, у вас нет возможности редактировать код HTML напрямую или вы не хотите этим заниматься. В вашей системе управления контентом, скорее всего, имеется средство для создания метатегов ( meta ) или подобные инструменты.

Если вы хотите добавить тег meta на свой сайт, найдите в системе управления контентом инструкции о том, как изменять раздел на странице (пример запроса: «Wix метатеги» или «wix добавить тег meta «).

Эти теги meta указывают поисковым системам, как следует сканировать и индексировать веб-страницы.

Тег meta с атрибутами robots и googlebot заданы разные настройки, применяются те из них, которые накладывают наиболее строгие ограничения. Например, если один из них устанавливает значение max-snippet:50 , а другой – nosnippet , будет использован вариант nosnippet .

Читайте также:  Php fpm http headers

По умолчанию используются значения index, follow , поэтому отдельно их указывать необязательно. Чтобы узнать, какие значения понятны роботам Google, ознакомьтесь со списком допустимых правил.

Эту же информацию можно указывать в HTTP-заголовке с помощью правила X-Robots-Tag . Это вариант позволяет, в частности, исключить из индекса изображения и прочие файлы в формате, отличном от HTML. Подробнее о метатегах robots…

Источник

Описание мета-тегов

Посмотрев HTML код разных сайтов возникает вопрос – зачем в нем так много мета-тегов и для чего они нужны? В данной статье представлены все самые встречающеюся теги с примерами и пояснениями.

Описание страницы

Title

Заголовок страницы, оптимальная длина 50-60 символов.

Description

Краткое описание страницы длинной 160-180 символов, используется в выводе результатов поиска.

Keywords

Содержит ключевые слова встречающихся на странице. Не более 20-ти слов и 3-х повторов.

Кодировка сайта

Application-Name

Название веб-приложения. Можно указать несколько названий для разных языковых локалей.

  • В Android используется при добавлении сайта на главный экран.
  • В Windows 8, 10 при добавлении сайта в панель приложений и плиткой в меню пуск.

Generator

Сообщает, с помощью какой программы был сгенерирован код страницы.

Author

Информация об авторе сайта.

Информация о владельце сайта.

Reply-To

Указывает способ связи с автором страницы.

Content-Language

Указывает язык страницы. Используется поисковыми машинами при индексировании.

Help

Предоставляет ссылку на справку или e-mail.

Управление индексацией

Robots

Задает правила индексации для поисковых роботов.

Общие значения:

index , follow или all Разрешено индексировать текст и ссылки на странице
noindex Не индексировать текст страницы
nofollow Не переходить по ссылкам на странице
noindex , nofollow или none Запрещено индексировать текст и переходить по ссылкам
noarchive Не показывать ссылку на сохраненную копию в поисковой выдаче
noyaca Не использовать описание из Яндекс.Каталога для сниппета в результатах поиска
nosnippet Запрещает показывать видео или фрагмент текста в результатах поиска
noimageindex Запрещает указывать вашу страницу как источник ссылки для изображения
noodp Не использовать описание из каталога DMOZ

Last-Modified

Альтернативно HTTP-заголовку Last-Modified задает дату последнего изменения для статических страниц.

Document-State

Определяет частоту индексации для поисковых роботов.

Revisit-After

Указывает как часто обновляется информация на сайте, и как часто поисковая система должна на него заходить.

Управление кэшированием

Cache-Control

Указывает как браузеру кэшировать страницу.

Допустимые значения:

public Кэшируется все
private Кэшируется браузером, но не proxy-сервером
no-cache Запрещает кэширование
max-age=0 Сколько секунд хранить в кэше

Pragma

Expires

Дата окончания кэша браузера. Если указать прошедшую дату или 0, то документ не будет кэшироваться.

Canonical — предпочитаемый канонический адрес

Если у страницы есть дубликаты с одним содержанием и разными URL, например:

В rel=»canonical» указывается адрес, который будет считаться основным и будет использоваться в поисковой выдаче.

Prev

Указывает URL предыдущий страницы при пагинации.

Next

Указывает URL следующий страницы при пагинации.

Источник

HTTP headers, meta elements and language information

In addition to the lang (and/or xml:lang) attribute on the html tag, you may come across language information in HTML meta elements, or in the HTTP header which is served with an HTML page. Here we look at whether these are useful when declaring language for HTML content, and if so, how they should be used.

This article is (specifically) about language declarations in HTTP headers and meta elements. It’s not a general guide to setting language on an HTML page: for that, see Declaring language in HTML .

This article builds on the distinction between (1) using file metadata to identify the audience for the document, and (2) specifying the language used for the purpose of processing content. If you want to better understand the distinction see the article Types of language declaration.

The meta element

You may come across a language-related meta element near the top of an HTML file. It looks like this.

This use of the content-language value for an http-equiv attribute is deprecated by the HTML specification, and should no longer be used. Instead, you should always use a lang attribute on the html tag to declare the default language of the text in the page.

If you want to know why this approach is deprecated, see below. To learn about how to use the lang attribute, see Declaring language in HTML.

HTTP headers

When you retrieve a web page or resource from a server, the server sends with it various bits of information about the thing you are retrieving (metadata). It uses a format referred to as HTTP headers. One of the items you may find in such metadata is language related. See the last line in the example below that shows the HTTP response that accompanies this article.

Unlike the lang and xml:lang attributes, the value of the content attribute can be a comma-separated list of language tags. The example below declares the primary languages of the document to be (in equal measure) German, French and Italian.

If the name of the meta element wasn’t a clear enough clue, the fact that the value supports multiple languages indicates that this element is really about document level metadata. If you are to usefully indicate the language of a range of text, you have to be specific – it can only be in one language at a time. The meta element, then, is an in-document location for expressing metadata about the language of the intended audience of the document as a whole.

Until recently, few browsers paid any attention to this meta element. Then several major browsers began using this element, if there was no language attribute on the html tag, to set the default language of the text in the document (what you should use a language attribute on the html tag for). The way this was implemented was inconsistent, and therefore unreliable, from one browser to another.

Because of the history of confusion and inconsistent implementation surrounding this kind of declaration, in 2011 the HTML Working Group took a decision to make the meta element with http-equiv set to Content-Language non-conforming in HTML. This means that you should no longer use it in HTML5, and therefore, though technically not illegal in other types of HTML, it is best to now not use it anywhere.

HTML5 did, however, make a concession for backwards compatibility. If there is a meta element with http-equiv set to Content-Language in the markup, and if there is no language attribute on the html tag, and if the meta element has a value that is a single language tag, then a browser must use that information to guess at the default language of the text on the page. Having said that, this is only for backwards compatibility, and you really shouldn’t use this approach any more. Simply use a language attribute on the html tag.

Document-internal metadata

One implication of HTML5 dropping the meta element for declaring language is that there is now no obvious way to provide metadata about the document inside the document itself. In theory it would be quite useful for content management systems, translation processes, and the like. This kind of information can be carried by an HTTP header (as we’ll see in the next section), but such systems and processes tend to work on documents that are not sent from a server with an HTTP header, and so in-document metadata would be useful.

Perhaps another approach, such as RDFa, would provide a way of representing such information in the future.

The WHATWG Wiki MetaExtensions page provides an extended list of values that could be used with the meta element’s name value, though none have been formally accepted yet. One such value is dc.language , used to express language information with Dublin Core notation.

Do not use this

It is unclear, however, that this information is ever used by browsers, or to what extent it is used by any other application. The WHATWG page recommends that the lang attribute be used instead. That recommendation is good for declaring the text-processing language, but doesn’t address its possible use for expressing metadata about the page as a whole.

Further reading

Источник

Оцените статью