View source: R/audit_canonicals.R
| audit_canonicals | R Documentation |
Analyzes a 'rel=canonical' data frame and returns a diagnostic report covering chain lengths, loops, conflicting sources (a page declaring multiple distinct canonicals), self-referencing canonicals, and terminal destinations. Mirrors [audit_redirects()] for the canonical signal; useful as a pre-flight check before passing 'canonicals_df' to [pagerank()].
Declared canonicals are an **advisory** signal, distinct from enforced 3xx redirects. To see how the two interact – which one wins on a shared source, and which canonicals are ignored because their source also redirects – use [audit_fold()].
audit_canonicals(
canonicals_df,
edge_list_df = NULL,
canonical_from_col = "from",
canonical_to_col = "to",
edge_from_col = "from",
edge_to_col = "to"
)
canonicals_df |
A data frame of declared canonical links, pairing a source URL with the canonical it declares. |
edge_list_df |
Optional data frame of edges. If provided, orphaned canonicals (sources not present in the edge list) are identified. |
canonical_from_col, canonical_to_col |
From/to columns in 'canonicals_df'. Default '"from"' / '"to"'. |
edge_from_col, edge_to_col |
From/to columns in 'edge_list_df'. Default '"from"' / '"to"'. |
A list with class '"canonical_audit"' mirroring the structure of [audit_redirects()]: 'n_rules', 'n_self_refs', 'self_refs', 'n_conflicts', 'conflicts', 'n_loops', 'loops', 'chains', 'max_chain_length', and (when 'edge_list_df' is given) 'orphaned_redirects' (orphaned canonical sources).
[audit_redirects()], [audit_fold()], [build_fold_map()]
canonicals <- data.frame(
from = c("http://a?x=1", "http://b", "http://c"),
to = c("http://a", "http://canon", "http://c")
)
audit_canonicals(canonicals)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.