View source: R/resolve_canonicals.R
| resolve_folded_urls | R Documentation |
Resolves URL vectors with the same composed 3xx redirect plus declared 'rel=canonical' fold-map engine used by [pagerank()] and [build_fold_map()]. This helper performs signal folding only; it does not perform URL syntax canonicalization.
resolve_folded_urls(
urls,
redirects_df = NULL,
canonicals_df = NULL,
redirect_from_col = "from",
redirect_to_col = "to",
canonical_from_col = "from",
canonical_to_col = "to",
duplicate_from_policy = c("strict", "first_wins", "last_wins", "most_frequent",
"prune_source", "resolve_if_consistent"),
loop_handling = c("error", "prune_loop", "break_arrow"),
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"),
canonical_conflict_policy = c("redirect_wins", "error", "canonical_wins")
)
urls |
Character vector of URLs to resolve. |
redirects_df |
Optional data frame of redirect rules, or 'NULL'. |
canonicals_df |
Optional data frame of declared canonical links, or 'NULL'. |
redirect_from_col, redirect_to_col |
From/to columns in 'redirects_df'. Default '"from"' / '"to"'. |
canonical_from_col, canonical_to_col |
From/to columns in 'canonicals_df'. Default '"from"' / '"to"'. |
duplicate_from_policy |
How to handle a redirect source with multiple distinct targets. See [resolve_redirects()]. Default '"strict"'. |
loop_handling |
How to handle redirect cycles. See [resolve_redirects()]. Default '"error"'. Also governs cross-signal cycles in the composed graph. |
canonical_duplicate_from_policy |
How to handle a canonical source with multiple distinct declared canonicals. Reuses the 'duplicate_from_policy' enum. Default '"strict"'. |
canonical_loop_handling |
How to handle cycles among declared canonicals. Reuses the 'loop_handling' enum. Default '"error"'. |
canonical_conflict_policy |
How to resolve a redirect-vs-canonical disagreement on the **same source** URL. One of:
|
A data frame with 'original', 'resolved', 'changed', and 'signal' columns. The exported fold map is attached as attribute '"fold_map"' and cross-signal audit tables are attached as '"conflicts"' and '"ignored_canonicals"'.
Other URL-vector resolvers:
resolve_canonical_urls(),
resolve_redirect_urls()
redirects <- data.frame(from = "B", to = "C")
canonicals <- data.frame(from = "A", to = "B")
resolve_folded_urls(c("A", "B", "X"), redirects, canonicals)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.