Seo Canonical Tag Checker avatar

Seo Canonical Tag Checker

Pricing

$0.01 / actor start

Go to Apify Store
Seo Canonical Tag Checker

Seo Canonical Tag Checker

Pricing

$0.01 / actor start

Rating

0.0

(0)

Developer

Eichan Jolly

Eichan Jolly

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

7 days ago

Last modified

Categories

Features

Limited permissions

Share

One job: read canonical <link rel="canonical"> declarations from the HTML <head> of one page. Ideal for site owners, SEOs, and developers who need a quick report of what a page itself declares.

The Actor does not decide whether a canonical is an appropriate SEO choice, nor does it validate the target URL with a network request.

Input

Just one input property, url (string): an HTTP(S) URL to a public HTML page.

{"url": "https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/link"}

This is also the prefilled example in input_schema.json. The URL was observed accessible without a redirect when checked on 2026-11-01. Public sites may change at any time. The sample is not a login-protected page.

Output

Output is written to the Apify default dataset (one JSON object per item), or to local storage/datasets/default/000000001.json, etc., when no Apify dataset ID is present.

{
"sourceUrl": "http://127.0.0.1:39085/canonical",
"pageUrl": "http://127.0.0.1:39085/canonical",
"canonicalUrl": "http://127.0.0.1:39085/canonical",
"canonicalCount": 1,
"isSelfReferencing": true,
"status": "ok",
"error": null,
"note": "This page declares itself as its own canonical."
}

This item comes from the included local fixture. An absent canonical produces canonicalUrl: null, canonicalCount: 0, isSelfReferencing: false, and status: "absent". Multiple canonical tags produce status: "multiple"; only the first canonical URL is displayed.

How to run

  1. Use Python 3.12+; no packages need installing. From this folder, set ACTOR_INPUT_JSON to the input JSON above and run python src/main.py.
  2. Alternatively, put the JSON in storage/key_value_stores/default/INPUT.json and run the same command.
  3. On Apify, the Actor reads INPUT from the default key-value store using its provided ID and APIFY_TOKEN, then POSTs the items to the default dataset; no Apify SDK is required.
  4. For verification, run python tests/test_actor.py and python tests/run_smoke.py. The latter launches a temporary local HTTP test server and captures the real script subprocess output and JSON under tests/evidence/.

Input priority: ACTOR_INPUT_JSON → APIFY_DEFAULT_KEY_VALUE_STORE_ID with authenticated Apify GET → local INPUT.json. There is no exact-match check against an APIFY_API_BASE_URL environment value; the standard https://api.apify.com endpoint is used directly.

Limits and safeguards

  • One public HTML page; examines only canonical <link> elements inside <head>. Does not use HTTP Link response headers or JavaScript-generated tags.
  • Relative canonical URLs are resolved using the document's first <base href> if present, otherwise the fetched URL; fragments are stripped.
  • Self-reference compares the normalized page and canonical URL (case-folding the hostname, removing default ports and fragments); query strings remain significant.
  • Multiple declarations are counted, but only the first URL is output. An empty first canonical is reported as null.
  • Does not execute JavaScript, log into sites, use search-engine results, or fetch third-party website pages. No keys except Apify's own platform storage token.
  • Honors robots.txt for the requested page and checked same-host redirects. A missing robots.txt (HTTP 404/410) is treated as no explicit restriction; other verification failures are returned as plain-language errors.
  • Enforces HTTPS/HTTP, publicly routable DNS addresses, a 12-second timeout per request, up to 3 same-host redirects, and a 1.5 MB maximum HTML response. The server may impose its own rate limits.
  • Script-mode tests use a temporary loopback-only test flag (SEO_ACTOR_ALLOW_LOOPBACK=1) and local fixtures; production use should leave this flag unset. Live Apify deployment and Docker builds were not performed.
  • Errors are emitted as dataset items with stable null values and status: "error", rather than Python tracebacks. If the dataset service is unavailable, a plain-language terminal error is printed.

Store suggestions (not configured)

Categories: SEO tools, Marketing, Developer tools. Suggested price: $0.01 per run. Store details are recorded in store_metadata.json. Nothing is published or billed automatically.