Giter Club home page Giter Club logo

amp-validator's Introduction

AMP validation Example

Total Downloads Latest Version License


About AMP validation CLI tool

Test your Accelerated Mobile Pages right away from your terminal.

AMP online validation tool

This package uses CLOUDFARE's AMP validator API.

Installation

Via Composer

composer global require jeffochoa/amp-validator

Manually

First, download the binary using wget:

wget https://github.com/jeffochoa/amp-validator/blob/master/builds/amp-validator -O amp-validator

Change binary permissions:

sudo chmod ax amp-validator

Move to bin directory:

sudo mv amp-validator /usr/local/bin/amp-validator

Usage

amp-validator

Singe page validation

The given URL should be publicly accessible.

amp-validator validate http://website.test/valid-amp-link

Validate a batch of links

You can use the generated CSV report by Google Webmaster Tools (GWT) as input to validate locally.

AMP online validation tool

Go to https://www.google.com/webmasters/tools/accelerated-mobile-pages

Download the AMP report in Search Appearance / Accelerate mobile pages

Once you have the file downloaded locally:

amp-validator validate-batch path-to-file/downloaded.csv

This tool will read the CSV file generated on GWT to run the validation on each tests contained in the file, then you can select between the different types of output formats to export your report.


    Please select an output format
    ----------------------------------------------------------------------------------

    ● Export to CSV file
    ○ In console (summarized)
    ○ In console (extended)
    ○ Cancel

Extra help to fix the errors in your page

The following example is the output generated using the "In console (extended)" option:

-----------------------------------------------------------------------------------
| Key     | Value                                                                    |
-----------------------------------------------------------------------------------
| link    | https://you-given-url.test                                               |
| error   | The attribute 'target' in tag 'a' is set to the invalid value 'blank'.   |
| line    | 1221                                                                     |
| col     | 3                                                                        |
| code    | INVALID_ATTR_VALUE                                                       |
| help    | https://www.ampproject.org/docs/reference/spec#links                     |
| preview | https://search.google.com/test/amp?url=https://you-given-url.test        |
------------------------------------------------------------------------------------

If you click on the preview link, you'll be taken to the online google validation tool.

AMP online validation tool

License

AMP Validator is an open-sourced software licensed under the MIT license.

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.