resolve_canonical_urls: Resolve URLs through rel=canonical declarations

View source: R/resolve_canonicals.R

resolve_canonical_urlsR Documentation

Resolve URLs through rel=canonical declarations

Description

Resolves a character vector through declared 'rel=canonical' folds. This is distinct from URL syntax canonicalization; inputs are expected to already be in the same URL namespace as the canonical table.

Usage

resolve_canonical_urls(
  urls,
  canonicals_df,
  canonical_from_col = "from",
  canonical_to_col = "to",
  canonical_duplicate_from_policy = c("strict", "first_wins", "last_wins",
    "most_frequent", "prune_source", "resolve_if_consistent"),
  canonical_loop_handling = c("error", "prune_loop", "break_arrow")
)

Arguments

urls

Character vector of URLs to resolve.

canonicals_df

A data frame of declared canonical links.

canonical_from_col, canonical_to_col

From/to columns in 'canonicals_df'.

canonical_duplicate_from_policy

How to handle a canonical source with multiple distinct targets. See [build_fold_map()].

canonical_loop_handling

How to handle canonical cycles. See [build_fold_map()].

Value

A data frame with 'original', 'resolved', 'changed', and 'signal' columns. The applied fold map is attached as attribute '"fold_map"'.

See Also

Other URL-vector resolvers: resolve_folded_urls(), resolve_redirect_urls()

Examples

canonicals <- data.frame(
  from = c("A", "B"),
  to = c("B", "C")
)
resolve_canonical_urls(c("A", "B", "X"), canonicals)

pagerankr documentation built on Oct. 1, 2026, 5:09 p.m.