Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jeffochoa/amp-validator
AMP validation test
https://github.com/jeffochoa/amp-validator
Last synced: 3 months ago
JSON representation
AMP validation test
- Host: GitHub
- URL: https://github.com/jeffochoa/amp-validator
- Owner: jeffochoa
- License: mit
- Created: 2018-07-08T16:55:27.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-11-05T10:33:18.000Z (over 4 years ago)
- Last Synced: 2024-08-15T00:17:29.438Z (6 months ago)
- Language: PHP
- Size: 5.43 MB
- Stars: 14
- Watchers: 2
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-laravel-zero - AMP validation CLI
README
![]()
------
## About AMP validation CLI tool
Test your Accelerated Mobile Pages right away from your terminal.
[![AMP online validation tool](https://raw.githubusercontent.com/jeffochoa/amp-validator/master/docs/validation-video.jpg)](https://www.ampproject.org/docs/fundamentals/validate)
This package uses CLOUDFARE's [AMP validator API](https://blog.cloudflare.com/amp-validator-api/).
## Installation
### Via Composer
```bash
composer global require jeffochoa/amp-validator
```### Manually
First, download the binary using `wget`:
```bash
wget https://github.com/jeffochoa/amp-validator/blob/master/builds/amp-validator -O amp-validator
```Change binary permissions:
```bash
sudo chmod ax amp-validator
```Move to bin directory:
```bash
sudo mv amp-validator /usr/local/bin/amp-validator
```## Usage
```bash
amp-validator
```### Singe page validation
The given URL should be publicly accessible.
```bash
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](https://www.google.com/webmasters/tools/home) (GWT) as input to validate locally.
[![AMP online validation tool](https://raw.githubusercontent.com/jeffochoa/amp-validator/master/docs/csv-download.png)](https://www.google.com/webmasters/tools/accelerated-mobile-pages)
Go to [https://www.google.com/webmasters/tools/accelerated-mobile-pages](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:
```bash
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.
```text
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:```text
-----------------------------------------------------------------------------------
| 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](https://raw.githubusercontent.com/jeffochoa/amp-validator/master/docs/test-online.jpg)
## License
AMP Validator is an open-sourced software licensed under the [MIT license](LICENSE.md).