Skip to content

Commit

Permalink
Merge pull request #31 from tilde-nlp/fix/canonical-tag-fix
Browse files Browse the repository at this point in the history
null check for head tag
  • Loading branch information
alexattt authored Aug 8, 2024
2 parents 4c5bd1c + 6e6ca80 commit 94464d9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/js/lib/SearchEngineOptimization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export class SearchEngineOptimization {

private markCanonicalUrl (doc: Document, currentLocale: string, restore = false) {
let link = doc.querySelector('link[rel="canonical"]') as HTMLLinkElement
if (!link) {
if (!link && doc.head !== null) {
link = document.createElement('link')
doc.head.appendChild(link)
link.rel = 'canonical'
Expand Down

0 comments on commit 94464d9

Please sign in to comment.