@segment/canonical

Get the current page's canonical URL.

Usage no npm install needed!

<script type="module">
  import segmentCanonical from 'https://cdn.skypack.dev/@segment/canonical';
</script>

README

canonical

CircleCI Codecov

Returns the canonical URL for the page.

Installation

$ npm install @segment/canonical

Example

<html>
<head>
  <link rel="canonical" href="http://example.com" />
</head>
</html>
var canonical = require('canonical');
canonical(); // http://example.com