Code Monkey home page Code Monkey logo

amp-mip-docs's Introduction

AMP/MIP Documentation

Documentation for AMP (Google) and MIP (Baidu).

Non-AMP/MIP Page Requirements

Link to AMP/MIP page

This link tells search engines where to find the AMP/MIP version of the webpage.

AMP

<link href="https://example.com/some-webpage-with-amp" rel="amphtml">

MIP

<link href="https://example.com/some-webpage-with-mip" rel="miphtml">

AMP/MIP Page Requirements

Document Type

The definition of the document type, to indicate which version of HTML the page is using. It should be HTML5, because older HTML doesn't support custom attributes.

AMP

<!DOCTYPE html>

MIP

<!DOCTYPE html>

HTML Tag

The first tag in the document, having a specific attribute to indicate that the page is an AMP or MIP page.

AMP

<html amp>

OR

<html >

MIP

<html mip>

Head

This element is mandiatory in both AMP and MIP.

AMP

<head>

MIP

<head>

Charset

The charset metadata should be present and should be UTF-8.

AMP

<meta charset="utf-8">

MIP

<meta charset="utf-8">

Canonical

There should be a canonical link. This should point to the non-AMP or non-MIP page, or in case AMP/MIP is the only page, to itself.

AMP

<link href="https://example.com/some-webpage-without-amp" rel="canonical">

MIP

<link href="https://example.com/some-webpage-without-mip" rel="canonical">

Viewport

There should be a viewport set. The width value is mandatory and should be device-width. Recommended it to add minimum-scale=1 and initial-scale=1 too.

AMP

<meta content="width=device-width" name="viewport">

MIP

<meta content="width=device-width" name="viewport">

Engine Script

The engine script should be present and should be asyncronically loaded.

AMP

<script async src="https://cdn.ampproject.org/v0.js"></script>

MIP

<script async src="https://c.mipcdn.com/static/v1/mip.js"></script>

OR

<script async src="https://c.mipcdn.com/static/v2/mip.js"></script>

Style Boilerplate

AMP/MIP pages use boilerplate code to disable some CSS rendering until the right moment.

AMP

<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style>

AND

<noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>

MIP

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

OR

<link href="https://c.mipcdn.com/static/v2/mip.css" rel="stylesheet" type="text/css">

Body

This element is mandiatory in both AMP and MIP.

AMP

<body>

MIP

<body>

Additionals

Loading custom elements

For loading custom elements that aren't loaded by default.

AMP

<script async custom-element="amp-gist" src="https://cdn.ampproject.org/v0/amp-gist-0.1.js"></script>

But src is not mandatory:

<script async custom-element="amp-gist"></script>

MIP

<script src="https://c.mipcdn.com/static/v2/mip-mustache/mip-accordion.js"></script>

Loading custom templates

For loading custom templates that aren't loaded by default.

AMP

<script async custom-template="amp-mustache" src="https://cdn.ampproject.org/v0/amp-mustache-0.2.js"></script>

But src is not mandatory:

<script async custom-template="amp-mustache"></script>

MIP

<script src="https://c.mipcdn.com/static/v2/mip-mustache/mip-mustache.js"></script>

amp-mip-docs's People

Contributors

ben221199 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.