front end relearn - tag meta

162 阅读2分钟

Concept

The tag provides metadata about the HTML document. Metadata will not be displayed on the page, but will be machine parsable.

Action

Meta elements are typically used to specify page description, keywords, author of the document, last modified, and other metadata.

Composition

meta tag has two property that http-equiv and name.the syntax like taht:

<meta name="params" content="something you want to show" />

name

keywords

for purpose of search engine optimization

    <meta name="keywords" content="your web keywords" />
description

due to tell web engine your website content

    <meta name="description" content="your web main content" />
viewport

in common use on mobile

- params
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
robot

tell spiders the index whether need

  • params:
    • none: the search engine will ignore page, be equivalent to noindex, nofollow
    • noindex: the search engine will ignore page, be equivalent to noindex, nofollow
    • nofollow: the search engine will ignore page, be equivalent to noindex, nofollow
    • all: the search engine will word for page, contain page links
    • index: the search engine will word for page, not contain page links
    • follow: the search engine will word for page links, not contain page
    <meta name="viewport" content="width=device-width, initial-scale=1" />
author

be used for label the author

    <meta name="author" content="author@xxx.com" />
generator

be used for indicate program tool

    <meta name="generator" content="visual studio code and so on" />
copyright

copyright message

    <meta name="copyright" content="copyright message" />
revisit-after

tell spider revisit after define time

    <meta name="revisit-after" content="7 days" />
renderer

define the render style of yonah browser

    <meta name="revisit-after" content="7 days" />

http-equiv

http-equiv is equivalent to doc title of http

    <meta http-equiv="params" content="specific descript">
content-Type

define the render style of yonah browser

    <meta charset="utf-8" />
X-UA-Compatible

define the render style of yonah browser

    <meta charset="utf-8" />
cache-control

control cache expire time

  • params:
    • no-cache: send request to server, then comnfirm web source whether already modify
    • no-store: send request every time
    • public: cahce all request
    • private: a few of user will cache source
    • maxage: cache can be use by time interval
    <meta http-equiv="cache-control" content="no-cache">
expires

control cache expire time

    <meta http-equiv="cache-control" content="no-cache">
refresh
    <meta http-equiv="refresh" content="2;URL=http://www.lxxyx.win/">
Set-Cookie
    <meta http-equiv="Set-Cookie" content="name, date" />
    <meta http-equiv="Set-Cookie" content="User=Lxxyx; path=/; expires=Sunday, 10-Jan-16 10:00:00 GMT">