From 2d837f49c2a359d84d5628bbc215b38e4949b00c Mon Sep 17 00:00:00 2001 From: Liran Cohen Date: Wed, 16 Oct 2019 15:03:47 +0300 Subject: [PATCH] remove checkup for amphtml link --- packages/next/pages/_document.tsx | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/packages/next/pages/_document.tsx b/packages/next/pages/_document.tsx index 985a8c1c54f75..c43ab17dcfe6e 100644 --- a/packages/next/pages/_document.tsx +++ b/packages/next/pages/_document.tsx @@ -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 @@ -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[])