Skip to content

Commit

Permalink
remove checkup for amphtml link
Browse files Browse the repository at this point in the history
  • Loading branch information
iliran11 committed Oct 16, 2019
1 parent e717cce commit 2d837f4
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions packages/next/pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,6 @@ export class Head extends Component<
badProp = 'name="viewport"'
} else if (type === 'link' && props.rel === 'canonical') {
hasCanonicalRel = true
} else if (type === 'link' && props.rel === 'amphtml') {
hasAmphtmlRel = true
} else if (type === 'script') {
// only block if
// 1. it has a src and isn't pointing to ampproject's CDN
Expand Down Expand Up @@ -303,14 +301,17 @@ export class Head extends Component<
}
return child
})
head = React.Children.map(head || [], child => {
if (!child) return child
const { type, props } = child
if (type === 'link' && props.rel === 'amphtml') {
hasAmphtmlRel = true
}
return child
})
// Handle non-amp logic
head = inAmpMode
? head
: React.Children.map(head || [], child => {
if (!child) return child
const { type, props } = child
if (type === 'link' && props.rel === 'amphtml') {
hasAmphtmlRel = true
}
return child
})
// try to parse styles from fragment for backwards compat
const curStyles: React.ReactElement[] = Array.isArray(styles)
? (styles as React.ReactElement[])
Expand Down

0 comments on commit 2d837f4

Please sign in to comment.