What meta tags to use, meta tag - its main meanings
Meta tags are used to set additional information about the site page. This information can be used by various services and programs - for example, search engines, browsers, as well as by the users themselves. It is important to correctly register the meta tags on the page - add the necessary ones and remove the ineffective and even harmful ones.
Meta tags are usually indicated in the head of the document, in the head tag. The meta tag has five main attributes:
- charset - serves to set the encoding of the document;
- content - serves to set the content of the meta tag, takes values depending on another specified attribute;
- http-equiv - as the name implies, serves to specify equivalents of HTTP headers directly on the page, that is, allows you to modify HTTP headers on the client side;
- name - serves to provide general information;
- scheme - serves to indicate information about the scheme of the document, little used attribute.
Let's start with the simplest, the charset attribute. This attribute is easy to use, it is enough to write one line of code, as a result of which the required encoding will be set for the document:
& lt; meta charset = "utf-8">
The content attribute is clear, it is used to set content for other attributes. Consider the following attribute - http-equiv . There are quite a few possible values for the attribute:
- cache-control - to control caching. Possible values: public, private, no-store, no-cache and others;
- content-language - to specify the language of the page, in HTML5 replaced by specifying the language in the html tag using the lang = "ru" attribute ;
- content-style-type - to override the style sheet language;
- content-type - to specify the MIME-type of the document, code table and other technical parameters of the text;
- expires - control page caching;
- pics-label - to indicate a standardized label that characterizes the content of the site;
- pragma - to control caching on dynamically generated pages;
- refresh - to instruct the browser to automatically switch to another address after the specified number of seconds;
- set-cookie - to set cookie values in the browser, in the content line you can specify values separated by semicolons in the form key = value. Possible keys: name, expires, domain, path, secure ;
- window-target - to specify the window for the current page, possible values: _blank, _parent, _self, _top and others;
- cleartype - allows you to activate the ClearType font anti-aliasing technology, works in Mobile IE;
- x-ua-compatible - for IE browsers. By specifying the desired value, you can disable compatibility mode and use the latest engine version.
- author - article author;
- copyright - copyright, you can specify the name of the company, etc .;
- description - page description, important for search engines. Optimal length is 70 to 140 characters;
- document-state - indicates the frequency of changes to the content on the page. Possible values: static, dynamic ;
- generator - indicates which system the site is running on, it is better to remove and not write this tag for the sake of site security;
- keywords - keywords, separated by commas. Not so important for promotion lately;
- resource-type - describes a property or state of the page. Possible values: document, rating, version, operator, formatter, creation ;
- revisit - allows you to inform search robots about the desired period of document re-indexing in the search engine .;
- robots - controls page indexing, allows you to specify instructions for search robots;
- subject - defines the subject of the document;
- url - stops indexing the page by the search engine and redirects the robot to the specified link;
- viewport - indicates data for setting the viewport, informs search engines and browsers about the presence of mobile adaptation of the site page.
Having considered what meta tags are and their meanings, you can try to answer the question - which meta tags to use on the site. Most of the above values are needed in specific situations; you should use only those tags that are really useful. For example, a minimal list of such tags might look like this:
& lt; meta charset = "utf-8">
& lt; meta name = "viewport" content = "width = device-width, initial-scale = 1.0">
& lt; meta name = "keywords" content = "keyword 1, keyword 2, keyword 3">
& lt; meta name = "description" content = "Description of the page, the recommended size is from 70 to 140 characters, and the maximum processed size is 400">
The first tag in this example is for specifying the page encoding, the second for managing display on mobile devices, the third for specifying keywords, and the fourth for specifying a description.
The article covered various meta tags and their main meanings, for each project it is worth choosing the right tags based on your specific needs.
Latest articles
- 03.04.24IT / Уроки PHP Уроки простыми словами. Урок 3. Все операторы PHP с примерами, с выводом работы кода на экран.
- 02.04.24IT / Уроки PHP Уроки простыми словами. Урок 2. Типы данных в PHP с примерами.
- 02.04.24IT / Уроки PHP Уроки простыми словами. Урок 1. Коротко о языке веб-программирования PHP. Основы синтаксиса.
- 09.11.23IT / Database Errors when migrating from MySQL 5.6 to 5.7 and how to fix them - database dump import failed with an error or INSERT does not work. Disabling STRICT_TRANS_TABLES strict mode or using IGNORE
- 08.07.22IT / Misc Convert office files DOC, DOCX, DOCM, RTF to DOCX, DOCM, DOC, RTF, PDF, HTML, XML, TXT formats without loss and markup changes