canonical-url
Advanced tools
Comparing version 1.0.5 to 1.0.6
@@ -18,6 +18,6 @@ "use strict"; | ||
class Canonical { | ||
constructor(url, canonicalTag) { | ||
constructor(url, canonicalTag, title) { | ||
this.url = new URL(url); | ||
this.canonicalTag = canonicalTag; | ||
this.title = ''; | ||
this.title = title; | ||
this.allSearchParams = []; | ||
@@ -31,3 +31,5 @@ this.url.searchParams.sort(); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
this.title = yield this.getTitleFromUrl(this.url.href); | ||
if (!this.title) { | ||
this.title = yield this.getTitleFromUrl(this.url.href); | ||
} | ||
// test canonical tag | ||
@@ -34,0 +36,0 @@ if (this.canonicalTag) { |
{ | ||
"name": "canonical-url", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "Attempt to find the least common denominator of similar urls", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -12,7 +12,7 @@ import wretch from 'wretch'; | ||
constructor (url: string, canonicalTag: string) { | ||
constructor (url: string, canonicalTag: string, title: string) { | ||
this.url = new URL(url); | ||
this.canonicalTag = canonicalTag; | ||
this.title = ''; | ||
this.title = title; | ||
@@ -27,3 +27,5 @@ this.allSearchParams = []; | ||
async findUrl () { | ||
this.title = await this.getTitleFromUrl(this.url.href); | ||
if (!this.title) { | ||
this.title = await this.getTitleFromUrl(this.url.href); | ||
} | ||
// test canonical tag | ||
@@ -30,0 +32,0 @@ if (this.canonicalTag) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17713
235