1
mirror of https://github.com/jakejarvis/get-canonical-url.git synced 2025-04-26 06:35:22 -04:00
dependabot[bot] 9f2d7e65c8
📦 npm: Bump @typescript-eslint/eslint-plugin from 5.3.1 to 5.54.0
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 5.3.1 to 5.54.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.54.0/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-28 04:02:20 +00:00
2021-11-11 11:11:03 -05:00
2021-11-11 11:11:03 -05:00
2021-11-11 11:11:03 -05:00
2021-09-29 20:49:54 -04:00
2021-11-11 11:11:03 -05:00
2021-09-29 20:49:54 -04:00
2021-09-29 20:49:54 -04:00
2021-09-29 20:49:54 -04:00
2021-11-11 11:11:03 -05:00

🔗 get-canonical-url

CI npm

Determines the current page's canonical URL and optionally normalizes it via normalize-url for consistency.

Install

npm install get-canonical-url
# or...
yarn add get-canonical-url

Or pull directly from unpkg in-browser:

<script src="https://unpkg.com/get-canonical-url/dist/get-canonical-url.min.js"></script>

Usage

<!doctype html>
<html>
<head>
  <link rel="canonical" href="https://www.example.com/this/doesnt/exist.aspx?no=really&it=doesnt#gocheck">
</head>
</html>
import canonicalUrl from "get-canonical-url";

canonicalUrl();
//=> 'https://www.example.com/this/doesnt/exist.aspx?no=really&it=doesnt#gocheck'

canonicalUrl({
  normalize: true,
  normalizeOptions: {
    stripProtocol: true,
    stripWWW: true,
    stripHash: true
  }
})
//=> 'example.com/this/doesnt/exist.aspx?it=doesnt&no=really'
import canonicalUrl from "get-canonical-url";

canonicalUrl({
  guess: true,
  normalize: true
});
//=> Determined via the individual user's window.location.href or other similar browser hints. Normalizing is recommended.

API

canonicalUrl(options?)

options

Type: object

normalize

Type: boolean
Default: false

Clean-up and normalize the determined canonical URL.

normalizeOptions

Type: NormalizeOptions
Default:

{
  stripWWW: false,
  stripHash: true,
  removeQueryParameters: true,
  removeTrailingSlash: false
}

Options passed directly to normalize-url.

Requires options.normalize = true.

guess

Type: boolean
Default: false

Make an educated guess using other clues if canonical isn't explicitly set in the page's <head>.

License

MIT

Description
🔗 Determines the current page's canonical URL and optionally normalizes it for consistency.
https://www.npmjs.com/package/get-canonical-url Readme MIT 2.3 MiB
Languages
TypeScript 53.6%
JavaScript 46.4%