十二步轻松打造百度移动端加速页面MIP

百度MIP改造:MIP HTML规范

打开移动站点模板

1.修改开头为:
<!DOCTYPE html>

2.第二句改为:
<html mip>

3.<head> 必须完全小写

4.修改编码声明:必须是utf-8
<meta charset="UTF-8">

5.head中加入:
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">

6.加入css样式

<link rel="stylesheet" type="text/css" href="https://mipcache.bdstatic.com/static/v1/mip.css">

7.head加入对应的移动页面,如果没有对应直接写当前页面

<linkrel="standardhtml" href="https://www.baidu.com">


8.Body改造,<body>必须是小写

9.加入js
<script src="https://mipcache.bdstatic.com/static/mipmain-v0.0.1.js"></script>


10.页面中常用的html代码有些需要修改,而有些禁止使用,页面中的资源尽量使用相对地址

11.一些特定的js功能需要查看https://www.mipengine.org/doc/2-tech/1-mip-html.html

12.做好后检查代码规范:https://www.mipengine.org/validator/validate