jeffochoa / amp-validator
立即从您的终端测试您的加速移动页面。
v1.0.1
2018-07-22 13:52 UTC
Requires
- php: ^7.1.3
Requires (Dev)
- kitetail/zttp: dev-master
- laravel-zero/framework: 5.6.*
- league/csv: ^9.0
- phpunit/phpunit: ^7.1
This package is auto-updated.
Last update: 2024-09-11 14:28:05 UTC
README
关于AMP验证CLI工具
立即从您的终端测试您的加速移动页面。
此包使用CLOUDFARE的AMP验证API。
安装
通过Composer
composer global require jeffochoa/amp-validator
手动安装
首先,使用wget
下载二进制文件
wget https://github.com/jeffochoa/amp-validator/blob/master/builds/amp-validator -O amp-validator
更改二进制文件的权限
sudo chmod ax amp-validator
移动到bin目录
sudo mv amp-validator /usr/local/bin/amp-validator
用法
amp-validator
单个页面验证
提供的URL应该是公开可访问的。
amp-validator validate http://website.test/valid-amp-link
验证链接批处理
您可以使用由Google Webmaster Tools (GWT)生成的CSV报告作为本地验证的输入。
转到https://www.google.com/webmasters/tools/accelerated-mobile-pages
在搜索外观/加速移动页面
中下载AMP报告
一旦您已将文件下载到本地
amp-validator validate-batch path-to-file/downloaded.csv
此工具将读取GWT生成的CSV文件,对文件中包含的每个测试进行验证,然后您可以选择不同的输出格式来导出报告。
Please select an output format
----------------------------------------------------------------------------------
● Export to CSV file
○ In console (summarized)
○ In console (extended)
○ Cancel
帮助修复页面中的错误
以下示例是使用“控制台(扩展)”选项生成的输出
-----------------------------------------------------------------------------------
| 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 |
------------------------------------------------------------------------------------
如果您点击预览
链接,您将被带到在线google验证工具。
许可证
AMP验证器是一个开源软件,许可协议为MIT许可。