@acot/acot-runner-sitemap 中文文档教程
@acot/acot-runner-sitemap
一个 acot 自定义运行器从站点地图读取审计页面。
Installation
通过 npm 安装:
$ npm install --save-dev @acot/acot-runner-sitemap
Usage
将 @acot/sitemap
添加到 配置文件<的 runner
字段/a>。
{
"runner": {
"uses": "@acot/sitemap",
"with": {
"source": "https://acot.example/sitemap.xml",
"random": [
{
"pattern": "/articles/**/*",
"limit": 3
}
]
}
}
}
Options
source
类型: 字符串
必需: true
sitemap.xml
的 URL
{
"runner": {
"uses": "@acot/sitemap",
"with": {
"source": "https://acot.example/sitemap.xml"
}
}
}
include
类型: string[]
< br> 必需 false
要包含在审核目标中的页面路径模式。 有关模式字符串,请参阅 micromatch 文档。
{
"runner": {
"uses": "@acot/sitemap",
"with": {
"source": "https://acot.example/sitemap.xml",
"include": ["*", "/guidelines/core-*", "/docs/**/*"]
}
}
}
exclude
类型: string[]
必需 false
要在审计目标中排除的页面路径模式。 有关模式字符串,请参阅 micromatch 文档。
{
"runner": {
"uses": "@acot/sitemap",
"with": {
"source": "https://acot.example/sitemap.xml",
"exclude": ["/articles/**/*"]
}
}
}
limit
类型: 数字
必需 false
要包含在审核目标中的最大页数。 如果未指定任何值,则所有页面都将成为审核目标。
{
"runner": {
"uses": "@acot/sitemap",
"with": {
"source": "https://acot.example/sitemap.xml",
"limit": 30
}
}
}
random
类型: <代码>{ 模式:字符串; 限制:数量}[]
必需: false
从匹配pattern
的页面列表中随机包含审计目标中limit
的数量。 当有大量页面使用同一模板时,通常会使用此选项。
{
"runner": {
"uses": "@acot/sitemap",
"with": {
"source": "https://acot.example/sitemap.xml",
"random": [
{
"pattern": "/articles/**/*",
"limit": 3
},
{
"pattern": "/news/*",
"limit": 2
}
]
}
}
}
headers
类型: Record
必需: false
获取在 source 中指定的 sitemap.xml
时使用的标头的键值。
{
"runner": {
"uses": "@acot/sitemap",
"with": {
"source": "https://acot.example/sitemap.xml",
"headers": {
"X-KEY": "value"
}
}
}
}
timeout
类型: 数字
默认值: 60000
必需: false
等待收集站点地图的最长时间(以毫秒为单位)。
{
"runner": "@acot/sitemap",
"with": {
"source": "https://acot.example/sitemap.xml",
"timeout": 120000
}
}
@acot/acot-runner-sitemap
An acot custom runner reading audit pages from sitemap.
Installation
Install via npm:
$ npm install --save-dev @acot/acot-runner-sitemap
Usage
Add @acot/sitemap
to the runner
field of the configuration file.
{
"runner": {
"uses": "@acot/sitemap",
"with": {
"source": "https://acot.example/sitemap.xml",
"random": [
{
"pattern": "/articles/**/*",
"limit": 3
}
]
}
}
}
Options
source
Type: string
Required: true
The URL of sitemap.xml
{
"runner": {
"uses": "@acot/sitemap",
"with": {
"source": "https://acot.example/sitemap.xml"
}
}
}
include
Type: string[]
Required: false
Page path pattern to include in audit target. See the micromatch documentation for pattern strings.
{
"runner": {
"uses": "@acot/sitemap",
"with": {
"source": "https://acot.example/sitemap.xml",
"include": ["*", "/guidelines/core-*", "/docs/**/*"]
}
}
}
exclude
Type: string[]
Required: false
Page path pattern to exclude in audit target. See the micromatch documentation for pattern strings.
{
"runner": {
"uses": "@acot/sitemap",
"with": {
"source": "https://acot.example/sitemap.xml",
"exclude": ["/articles/**/*"]
}
}
}
limit
Type: number
Required: false
Maximum number of pages to include in the audit target. If no value is specified, all pages will be audit targets.
{
"runner": {
"uses": "@acot/sitemap",
"with": {
"source": "https://acot.example/sitemap.xml",
"limit": 30
}
}
}
random
Type: { pattern: string; limit: number }[]
Required: false
Randomly include the number of limit
s in the audit target from the page list that matches pattern
. This option is typically used when there are a large number of pages using the same template.
{
"runner": {
"uses": "@acot/sitemap",
"with": {
"source": "https://acot.example/sitemap.xml",
"random": [
{
"pattern": "/articles/**/*",
"limit": 3
},
{
"pattern": "/news/*",
"limit": 2
}
]
}
}
}
headers
Type: Record<string, string>
Required: false
The key-value of the header used when fetching the sitemap.xml
specified in source.
{
"runner": {
"uses": "@acot/sitemap",
"with": {
"source": "https://acot.example/sitemap.xml",
"headers": {
"X-KEY": "value"
}
}
}
}
timeout
Type: number
Default: 60000
Required: false
Maximum time in milliseconds to wait for collecting sitemaps.
{
"runner": "@acot/sitemap",
"with": {
"source": "https://acot.example/sitemap.xml",
"timeout": 120000
}
}