What is the MIP verification rule?

Source: Internet
Author: User
Tags basic html page html tags json lowercase script tag tag name versions

This document is intended to help developers find the verification content and rules and quickly locate the reasons for the verification failure.

Incorrect mip html tag and attribute

1. Mandatory tags missing

Prompt

MANDATORY_TAG_MISSING

Error Description "The mandatory tag '% 1' is missing or incorrect ."
Error Description Mandatory Tag 'XXX' missing or incorrect
Solution Add (or correct) mandatory html tags

In mip html, mandatory tags include:

Description

Remarks

<! Doctype html> Case Sensitive
<Html mip> Force lowercase
<Head> Force lowercase
<Meta charset = "utf-8"> UTF-8 is case-insensitive and has no single quotation marks or double quotation marks.
<Meta name = "viewport" content = "width = device-width, initial-scale = 1"> It must be in lower case and has no single or double quotation marks.
<Link rel = "stylesheet" type = "text/css" href = "https://mipcache.bdstatic.com/static/v1/mip.css"> It must be in lower case and has no single or double quotation marks. v1.1.1 varies with versions.
<Script src = "https://mipcache.bdstatic.com/static/v1/mip.js"> </script> It must be in lower case and has no single or double quotation marks. v1.1.2 varies with versions.
<Body> Force lowercase
<Link rel = "canonical" href = "http (s): // xxx"> Force lowercase

PS: When the meta tag name = "viewport", the value of content must at least contain width = device-width, attributes minimum-scale = 1 and initial-scale = 1 are not fixed.

2. Disable tags

Prompt

DISALLOWED_TAG

Error Description "The tag '% 1' is disallowed ."
Error Description Disable the 'XX' label
Solution Delete a disabled tag

Most HTML tags are allowed. For more information about the tags that are disabled or need to be replaced, see the mip html specification.

3. Invalid attribute value

Prompt

INVALID_ATTR_VALUE

Error Description "The attribute '% 1' in tag' % 2' is set to the invalid value' % 3 '."
Error Description The property value 'XX' of attribute 'XX' in tag 'XX' is invalid.
Solution Change to valid attribute value

This error is reported when the html tag has incorrect attribute values. Note the following in mip:

A: The href attribute does not allow javascript: Protocol,

A: set the target attribute to _ blank.

Mip-img

Src: Must be a url

Mip-pix

Src: it must be an https-supported url,

If you use the https proxy provided by baidu Cloud, the url contains "t = {TIME} & title = {TITLE} & host = {HOST} & from = baidu"

Other basic html page attributes remain unchanged

Note:

1. The url in mip html must be https-secured.

2. <a> label:

<A href = "javascript: xxx ()"> </a> error

-<A href = "xxx" target = "_ blank"> </a>

4. Invalid value of the property value

Prompt

INVALID_PROPERTY_VALUE_IN_ATTR_VALUE

Error Description "The property '% 1' in attribute' % 2' in tag '% 3' is set to' % 4', which is invalid ."
Error Description The tag 'XX' contains the property 'yy', 'yy' has the property 'zic', and the property value 'a' of the property 'zic' is invalid.
Solution Invalid attribute value correction

Invalid values of attribute values may occur:

<Meta name = "viewport" content = "width = device-width, minimum-scale = 1, initial-scale = 1">

Property value of width: device-width

Initial-scale attribute value 1

<Script type = "application/ld + json"> </script>

<Script type = "application/json"> </script>

In addition to the js required for the external link MIP, the type attribute value of the script tag should be application/ld + json or application/json.

Note: All values except the preceding values are invalid.

5. The mandatory attribute is missing.

Prompt

MANDATORY_ONEOF_ATTR_MISSING

Error Description "The tag '% 1' is missing a mandatory attribute-pick one of % 2 ."
Error Description The mandatory attribute 'XX' of the tag 'XX' is missing.
Solution Adding correct attribute

For example, in mip html, mip-img and mip-pix have mandatory attributes of src:

Mip-img

Src

Mip-pix

Src

6. Direct parent label error

Prompt

WRONG_PARENT_TAG

Error Description "The parent tag of tag '% 1' is' % 2', but it can only be '% 3 '."
Error Description The direct parent label of tag 'A' should be 'B', not 'C'
Solution Add the required parent tag

Some labels have defined direct parent labels. The following example shows the direct parent labels required for each label:

! The direct parent label of doctype is root.

The direct parent label of head is html

The direct parent label of the body is html.

The direct parent label of link is head.

The direct parent label of meta is head.

Style mip-custom's direct parent label is head

The direct parent label of style is boilerplate.

7. Invalid parent label

Prompt

DISALLOWED_TAG_ANCESTOR

Error Description "The tag '% 1' may not appear as a descendant of tag' % 2 '."
Error Description Tag 'A' should not be a subtag of tag 'B'
Solution Delete illegal nested tags

For example:

The sub-tag of <body> is written in

8. Force parent labels

Prompt

MANDATORY_TAG_ANCESTOR

Error Description "The tag '% 1' may only appear as a descendant of tag' % 2 '."
Error Description Tag 'A' can only be a child tag of tag 'B'
Solution Delete tags or add correct parent labels to tags

Img must be a subtag of noscript

Video must be a subtag of noscript.

Audio must be a subtag of noscript.

When noscript is used in the head, it must be the last subnode of the head. There is no limit on noscript in the body.

9. Duplicate unique tags

Prompt

DUPLICATE_UNIQUE_TAG

Error Description "The tag '% 1' appears more than once in the document ."
Error Description The tag 'XX' can only appear once
Solution Delete unnecessary tags

Some tags in html are unique, that is, they can only appear once. When there are duplicate unique tags in html, an error should be reported.

The following is a list of unique tags:

<Doctype html>

<Html mip>

<Head>

<Link rel = "canonical" href =...>

<Meta charset = "utf-8">

<Meta viewport>

<Style mip-custom>

<Body>

MIP verification tool address: https://www.mipengine.org/validator/validate

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.