{"id":15748125,"url":"https://github.com/jakejarvis/get-canonical-url","last_synced_at":"2026-01-20T03:33:35.657Z","repository":{"id":36979653,"uuid":"411733036","full_name":"jakejarvis/get-canonical-url","owner":"jakejarvis","description":"🔗 Determines the current page's canonical URL and optionally normalizes it for consistency.","archived":false,"fork":false,"pushed_at":"2023-02-28T04:02:35.000Z","size":377,"stargazers_count":2,"open_issues_count":9,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-30T21:33:09.487Z","etag":null,"topics":["address","browser","canonical","dom","front-end","javascript","link","normalize","npm","uri","url"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jakejarvis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-09-29T15:39:16.000Z","updated_at":"2024-09-29T06:21:02.000Z","dependencies_parsed_at":"2024-10-25T04:18:12.336Z","dependency_job_id":"81214cd4-ed27-4c2c-a1f0-31c01637bab3","html_url":"https://github.com/jakejarvis/get-canonical-url","commit_stats":{"total_commits":10,"total_committers":1,"mean_commits":10.0,"dds":0.0,"last_synced_commit":"67a5b08d304f9e7fb7a2c49deb61479b2450f1fb"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakejarvis%2Fget-canonical-url","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakejarvis%2Fget-canonical-url/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakejarvis%2Fget-canonical-url/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakejarvis%2Fget-canonical-url/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jakejarvis","download_url":"https://codeload.github.com/jakejarvis/get-canonical-url/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247622968,"owners_count":20968572,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["address","browser","canonical","dom","front-end","javascript","link","normalize","npm","uri","url"],"created_at":"2024-10-04T05:40:40.205Z","updated_at":"2026-01-20T03:33:35.632Z","avatar_url":"https://github.com/jakejarvis.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🔗 get-canonical-url\n\n[![CI](https://github.com/jakejarvis/get-canonical-url/actions/workflows/ci.yml/badge.svg)](https://github.com/jakejarvis/get-canonical-url/actions/workflows/ci.yml)\n[![npm](https://img.shields.io/npm/v/get-canonical-url)](https://www.npmjs.com/package/get-canonical-url)\n\nDetermines the current page's canonical URL and optionally normalizes it via [normalize-url](https://github.com/sindresorhus/normalize-url) for consistency.\n\n## Install\n\n```sh\nnpm install get-canonical-url\n# or...\nyarn add get-canonical-url\n```\n\nOr pull directly from [unpkg](https://unpkg.com/browse/get-canonical-url/) in-browser:\n\n```html\n\u003cscript src=\"https://unpkg.com/get-canonical-url/dist/get-canonical-url.min.js\"\u003e\u003c/script\u003e\n```\n\n## Usage\n\n### With `\u003clink rel=\"canonical\"\u003e`\n\n```html\n\u003c!doctype html\u003e\n\u003chtml\u003e\n\u003chead\u003e\n  \u003clink rel=\"canonical\" href=\"https://www.example.com/this/doesnt/exist.aspx?no=really\u0026it=doesnt#gocheck\"\u003e\n\u003c/head\u003e\n\u003c/html\u003e\n```\n\n```js\nimport canonicalUrl from \"get-canonical-url\";\n\ncanonicalUrl();\n//=\u003e 'https://www.example.com/this/doesnt/exist.aspx?no=really\u0026it=doesnt#gocheck'\n\ncanonicalUrl({\n  normalize: true,\n  normalizeOptions: {\n    stripProtocol: true,\n    stripWWW: true,\n    stripHash: true\n  }\n})\n//=\u003e 'example.com/this/doesnt/exist.aspx?it=doesnt\u0026no=really'\n```\n\n### Without `\u003clink rel=\"canonical\"\u003e`\n\n```js\nimport canonicalUrl from \"get-canonical-url\";\n\ncanonicalUrl({\n  guess: true,\n  normalize: true\n});\n//=\u003e Determined via the individual user's window.location.href or other similar browser hints. Normalizing is recommended.\n```\n\n## API\n\n### canonicalUrl(options?)\n\n#### options\n\nType: `object`\n\n##### normalize\n\nType: `boolean`\\\nDefault: `false`\n\nClean-up and normalize the determined canonical URL.\n\n##### normalizeOptions\n\nType: [`NormalizeOptions`](https://github.com/sindresorhus/normalize-url/blob/main/index.d.ts)\\\nDefault:\n\n```js\n{\n  stripWWW: false,\n  stripHash: true,\n  removeQueryParameters: true,\n  removeTrailingSlash: false\n}\n```\n\nOptions passed directly to [`normalize-url`](https://github.com/sindresorhus/normalize-url#options).\n\nRequires `options.normalize = true`.\n\n##### guess\n\nType: `boolean`\\\nDefault: `false`\n\nMake an educated guess using other clues if canonical isn't explicitly set in the page's `\u003chead\u003e`.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjakejarvis%2Fget-canonical-url","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjakejarvis%2Fget-canonical-url","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjakejarvis%2Fget-canonical-url/lists"}