Skip to content

Commit

Permalink
with-google-analytics-amp needs <Head /> in Document component (#17462)
Browse files Browse the repository at this point in the history
If this component is missing, an error will be printed to the console

```
Expected Document Component Head was not rendered. Make sure you render them in your custom `_document`
See more info here https://err.sh/next.js/missing-document-component
```

Additionally, any components which use CSS modules will fail with an error.

This is documented in https://nextjs.org/docs/advanced-features/custom-document
  • Loading branch information
philihp committed Sep 30, 2020
1 parent 02d7504 commit f06c589
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion examples/with-google-analytics-amp/pages/_document.js
@@ -1,4 +1,4 @@
import Document, { Html, Main, NextScript } from 'next/document'
import Document, { Html, Head, Main, NextScript } from 'next/document'
import { useAmp } from 'next/amp'

import { GA_TRACKING_ID } from '../lib/gtag'
Expand All @@ -14,6 +14,7 @@ export default class MyDocument extends Document {
render() {
return (
<Html>
<Head />
<body>
<Main />
<NextScript />
Expand Down

0 comments on commit f06c589

Please sign in to comment.