meta is an auxiliary tag in the head area of the html language. Maybe you think these codes are optional. In fact, if you can use the meta tag well, it will bring you unexpected effects. The functions of meta tags include: search engine optimization (SEO), defining the language of the page, automatically refreshing and pointing to a new page, realizing dynamic effects when web page conversion, controlling page buffering, web page rating evaluation, controlling the windows displayed on the web page, etc.
The composition of meta tags: There are two attributes in the meta tag, name attribute, respectively, the http-equiv attribute and the name attribute. Different attributes have different parameter values, and these different parameter values realize different web page functions.
1. Name attribute
The name attribute is mainly used to describe a web page, and the corresponding attribute value is content. The content in the content is mainly used by search engine robots to find information and classify information.
The syntax format of the name attribute of the meta tag is:
<meta name=parameter content=specific parameter value>.
The name attribute mainly has the following parameters:
A. Keywords (keywords)
Description: keywords are used to tell search engines what keywords are on your web page.
Example: <meta name =keywords content=science, education, culture,politics,ecnomics,relationships,entertaiment,human>
B. Description (Website content description)
Description: Description is used to tell search engines the main content of your website.
Example: <meta name=description content=This page is about the meaning of science, education, culture.>
C. robots (robot guide)
Description: robots are used to tell search robots which pages need indexes and which pages do not need indexes.
The parameters of content are all, none, index, noindex, follow, nofollow. The default is all.
Example: <meta name=robots content=none>
D. Author(author)
Description: Label the author of the web page
For example: <meta name=author content=root,[email protected]>
2. http-equiv attribute
As the name suggests, http-equiv is equivalent to the file header of http. It can pass back some useful information to the browser to help display the web page content correctly and accurately. The corresponding attribute value is content, and the content in the content is actually the variable value of each parameter.
The syntax format of the http-equiv attribute of the meta tag is:
<meta http-equiv=parameter content=parameter variable value>;
Among them, the http-equiv attribute mainly has the following parameters:
A. Expires (term)
Note: It can be used to set the expiration time of the web page. Once the web page expires, it must be retransmitted to the server.
Usage: <meta http-equiv=expires content=Fri, 12 Jan 2001 18:18:18 GMT>
Note: GMT's time format must be used.
B. Pragma (cache mode)
Note: The browser is prohibited from accessing page content from the cache on the local computer.
Usage: <meta http-equiv=Pragma content=no-cache>
Note: This setting will allow visitors to browse offline.
C. Refresh (refresh)
Description: Automatically refresh and point to a new page.
Usage: <meta http-equiv=Refresh content=2;URL=http://www.root.net> (Note the quotes afterwards, before the seconds and after the URL respectively)
Note: 2 of them means that you will automatically refresh to the URL URL after staying for 2 seconds.
D. Set-Cookie (cookie settings)
Note: If the web page expires, the saved cookies will be deleted.
Usage: <meta http-equiv=Set-Cookie content=cookievalue=xxx; expires=Friday, 12-Jan-2001 18:18:18 GMT; path=/>
Note: GMT's time format must be used.
E. Window-target (display window settings)
Description: Force the page to be displayed as a separate page in the current window.
Usage: <meta http-equiv=Window-target content=_top>
Note: Used to prevent others from calling their own pages in the framework.
F, content-Type (display character set settings)
Description: Set the character set used on the page.
Usage: <meta http-equiv=content-Type content=text/html; charset=gb2312>
G, content-Language (display language settings)
Usage: <meta http-equiv=Content-Language content=zh-cn />
H, Cache-Control specifies the caching mechanism that requests and responses follow.
Cache-Control specifies the caching mechanism that requests and responses follow. Setting Cache-Control in a request message or response message does not modify the cache processing process in another message processing. The cache instructions during request include no-cache, no-store, max-age, max-stale, min-fresh, on
ly-if-cached, the instructions in the response message include public, private, no-cache, no-store, no-transform, must-revalidate, proxy-revalidate, max-age. The meaning of the command in each message is as followsPublic indicates that the response can be cached by any cache area
Private indicates that the entire or partial response message of a single user cannot be processed by a shared cache. This allows the server to describe only partial response message for the user, which is invalid for other users' requests
no-cache indicates that the request or response message cannot be cached
no-store is used to prevent important information from being published unintentionally. Sending in a request message will make neither the request nor the response message use cache.
max-age indicates that the client can receive responses whose lifetime is not greater than the specified time (in seconds)
min-fresh indicates that the client can receive a response whose response time is less than the current time plus the specified time
max-stale indicates that the client can receive a response message that has expired the timeout period. If the value of the max-stale message is specified, the client can receive a response message that exceeds the specified value after the timeout.
Meta tag usage tips:
Meta tags are a language used to describe web page attributes. Standard Meta tags can facilitate search engine sorting and improve search engine website weight rankings. If you want the website to be more in line with search engine standards, you must understand the meta tag. Here is a good idea for everyone to talk about the meaning and usage of meta tags:
1. Keywords of META tags
The writing method is: <meta name=Keywords content=Information parameters/>
The information parameters of the meat tag Keywords represent the keywords of the website.
2. Description of META tags
<meta name=Description content=Information parameter/
The information parameters of the meta tag Description represent the main content of the website and what is the overview.
3. http-equiv=Content-Type content=text/html of META tag
http-equiv=Content-Type represents the header protocol of HTTP, prompting the browser web page information.
<meta http-equiv=Content-Type content=text/html; charset=Information parameters/>
When the information parameters of the meta tag charset are GB2312, it means that the website uses the encoding in simplified Chinese;
When the information parameters of the meta tag charset are BIG5, it means that the website uses the encoding in traditional Chinese;
When the information parameters of the meta tag charset are as follows: iso-2022-jp, it means that the code used by the website is in Japanese;
When the information parameters of the meta tag charset are ks_c_5601, it means that the code used by the website is in Korean;
When the information parameters of the meta tag charset are as ISO-8859-1, it means that the code used by the website is in English;
When the information parameters of the meta tag charset are UTF-8, they represent the common language encoding in the world;
4. META tag generator
<meta name=generator content=information parameters/
The information parameters of the meta tag generator represent the description of what software the website uses to make.
5. Author of META tag
<meta name=author content=information parameters>
The information parameters of the author of the meta tag represent the author information of the copyright of the web page.
6. http-equiv=Refresh of META tag
<Meta http-equiv=Refresh Content=Time; Url=Website Parameters>
The meta tag Refresh represents how long the web page is automatically refreshed, and the URL parameters in Url represent how long it takes to automatically link other URLs.
7. HTTP-EQUIV of META tag = Pragma CONTENT=no-cache
<META HTTP-EQUIV=Pragma CONTENT=no-cache> means that the browser is prohibited from accessing page content from the cache of the local computer. This setting will allow visitors to browse offline.
8. COPYRIGHT of META tag
<META NAME=COPYRIGHT CONTENT=Information Parameters>
The information parameters of the COPYRIGHT of the meta tag represent the copyright information of the website.
9. http-equiv=imagetoolbar of META tag
<meta http-equiv=imagetoolbar content=false />
Specifies whether to display the image toolbar. If false means not to display, and if true means not to display.
10. Content-Script-Type of META tag
<Meta http-equiv=Content-Script-Type Content=text/javascript>
W3C web page specification, indicating the type of scripts in the page.
11. Revisit-after of META tag
<META name=revisit-after CONTENT=7 days >
revisit-after represents website revisit, 7 days represents 7 days, and so on.
12. Robots of META tag <meta name=Robots contact=information parameters>
Robots representative tells search engines which pages to crawl
The attributes are described as follows:
The information parameter is all: the file will be retrieved, and the links on the page can be queried;
The information parameter is none: the file will not be retrieved, and the links on the page cannot be queried;
The information parameter is index: the file will be retrieved;
The information parameter is follow: the link on the page can be queried;
The information parameter is noindex: the file will not be retrieved, but the links on the page can be queried;
The information parameter is nofollow: the file will be retrieved, but the links on the page cannot be queried;