Per-engine robots context preset (sitemap-spec §13.0)
Source:R/robots-context.R
robots_context_preset.RdA construction-time preset selecting one engine's robots product token,
status policy and matcher together, so a caller need not know which token a
bounded matcher backend accepts. It is a thin wrapper over
robots_context(); every axis stays independently overridable by calling
that constructor directly.
Usage
robots_context_preset(preset = robots_context_presets())Arguments
- preset
A single preset name; see
robots_context_presets(). Defaults to"google".
Value
An object of class sitemapr_robots_context, the same shape
robots_context() returns, carrying the expanded axis values plus the
preset name.
Details
The preset's values are expanded onto the returned context rather than
re-derived at use time, so the result records exactly which product token,
policy ruleset and matcher backend the preset selected. The name is retained
on $preset for provenance.
A preset selects a robots engine only. It does not select a sitemap ruleset, and no sitemap ruleset selects it (ADR-009 §1): the bridge between the two value sets is this documented preset, never a silent derivation.
Not every preset is runnable on every install. robotstxtr publishes a
matcher_availability per backend, and one reporting
capability_unavailable decides nothing — a context on it evaluates
cleanly but reports every URL as ROBOTS_INDETERMINATE rather than
guessing.
See also
robots_context() for the general constructor and
validate_sitemap_robots() for the entry point that accepts the result.
Examples
robots_context_preset("google")
#> $product_token
#> [1] "Googlebot"
#>
#> $policy_ruleset
#> [1] "google"
#>
#> $matcher_backend
#> [1] "google"
#>
#> $preset
#> [1] "google"
#>
#> attr(,"class")
#> [1] "sitemapr_robots_context"
# The EXPANDED values are readable back off the context.
yandex <- robots_context_preset("yandex")
yandex$product_token
#> [1] "Yandex"
yandex$matcher_backend
#> [1] "yandex"