Skip to content

Commit 3dfc88b

Browse files
committed
Cope with pages that have no canonical at all.
1 parent 7d645ea commit 3dfc88b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

FrontEnd/scripts/debug_panel.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ export class SPIDebugPanel extends HTMLElement {
7676
}
7777

7878
addCanonicalUrls() {
79-
const canonicalUrl = document.querySelector('link[rel="canonical"]').href
79+
const canonicalUrl = document.querySelector('link[rel="canonical"]')?.href
8080
const windowUrl = window.location.href
8181
const matchingCanonicalUrl = canonicalUrl === windowUrl
8282

83-
this.newTableRow('Canonical URL', canonicalUrl)
83+
this.newTableRow('Canonical URL', canonicalUrl ? canonicalUrl : 'Missing', canonicalUrl ? null : 'red')
8484
this.newTableRow('Window URL', windowUrl)
8585
this.newTableRow('Canonical Match', matchingCanonicalUrl, matchingCanonicalUrl ? 'green' : 'red')
8686
}

0 commit comments

Comments
 (0)