From 44960c4683f27018958254f2db38fa156c58673b Mon Sep 17 00:00:00 2001
From: Henrik Wenz
Date: Tue, 23 Aug 2022 17:31:37 +0200
Subject: [PATCH] =?UTF-8?q?[docs]=C2=A0Update=20examples=20to=20favour=20f?=
=?UTF-8?q?unctional=20=5Fdocument?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
examples/auth-with-stytch/pages/_document.tsx | 47 +++------
examples/blog-starter/pages/_document.tsx | 24 +++--
examples/blog/pages/_document.tsx | 70 +++++--------
examples/cms-contentful/pages/_document.js | 24 +++--
examples/cms-cosmic/pages/_document.js | 24 +++--
examples/cms-datocms/pages/_document.js | 24 +++--
examples/cms-drupal/pages/_document.js | 24 +++--
examples/cms-ghost/pages/_document.js | 24 +++--
examples/cms-graphcms/pages/_document.js | 24 +++--
examples/cms-kontent/pages/_document.js | 24 +++--
examples/cms-prepr/pages/_document.js | 24 +++--
examples/cms-prismic/pages/_document.js | 24 +++--
examples/cms-sanity/pages/_document.js | 24 +++--
examples/cms-storyblok/pages/_document.js | 24 +++--
examples/cms-strapi/pages/_document.js | 24 +++--
examples/cms-takeshape/pages/_document.js | 24 +++--
examples/cms-tina/pages/_document.js | 24 +++--
.../cms-umbraco-heartcore/pages/_document.js | 24 +++--
examples/cms-wordpress/pages/_document.tsx | 24 +++--
examples/with-babel-macros/pages/_document.js | 28 +++---
.../with-facebook-pixel/pages/_document.js | 42 ++++----
.../pages/_document.js | 98 +++++++++----------
.../pages/_document.js | 40 ++++----
examples/with-next-offline/pages/_document.js | 35 +++----
.../pages/_document.js | 45 ++++-----
examples/with-portals/pages/_document.js | 28 +++---
examples/with-rebass/pages/_document.js | 30 +++---
examples/with-strict-csp/pages/_document.js | 40 ++++----
.../with-typescript-types/pages/_document.jsx | 17 ----
examples/with-unsplash/pages/_document.tsx | 31 +++---
30 files changed, 419 insertions(+), 540 deletions(-)
delete mode 100644 examples/with-typescript-types/pages/_document.jsx
diff --git a/examples/auth-with-stytch/pages/_document.tsx b/examples/auth-with-stytch/pages/_document.tsx
index 83d9080a67d716..496f4c465e5c33 100644
--- a/examples/auth-with-stytch/pages/_document.tsx
+++ b/examples/auth-with-stytch/pages/_document.tsx
@@ -1,33 +1,18 @@
-import Document, {
- Html,
- Head,
- Main,
- NextScript,
- DocumentContext,
-} from 'next/document'
+import { Html, Head, Main, NextScript } from 'next/document'
-class MyDocument extends Document {
- static async getInitialProps(ctx: DocumentContext) {
- const initialProps = await Document.getInitialProps(ctx)
- return { ...initialProps }
- }
-
- render() {
- return (
-
-
-
-
-
-
-
-
-
- )
- }
+export default function Document() {
+ return (
+
+
+
+
+
+
+
+
+
+ )
}
-
-export default MyDocument
diff --git a/examples/blog-starter/pages/_document.tsx b/examples/blog-starter/pages/_document.tsx
index c55951c0d5daff..54e8bf3e2a2901 100644
--- a/examples/blog-starter/pages/_document.tsx
+++ b/examples/blog-starter/pages/_document.tsx
@@ -1,15 +1,13 @@
-import Document, { Html, Head, Main, NextScript } from 'next/document'
+import { Html, Head, Main, NextScript } from 'next/document'
-export default class MyDocument extends Document {
- render() {
- return (
-
-
-
-
-
-
-
- )
- }
+export default function Document() {
+ return (
+
+
+
+
+
+
+ )
}
diff --git a/examples/blog/pages/_document.tsx b/examples/blog/pages/_document.tsx
index 40ab3703fb3198..9ea3d18aa61bbe 100644
--- a/examples/blog/pages/_document.tsx
+++ b/examples/blog/pages/_document.tsx
@@ -1,47 +1,31 @@
-import Document, {
- Html,
- Head,
- Main,
- NextScript,
- DocumentContext,
-} from 'next/document'
+import { Html, Head, Main, NextScript, DocumentContext } from 'next/document'
-class MyDocument extends Document {
- static async getInitialProps(ctx: DocumentContext) {
- const initialProps = await Document.getInitialProps(ctx)
- return { ...initialProps }
+export default function Document() {
+ const meta = {
+ title: 'Next.js Blog Starter Kit',
+ description: 'Clone and deploy your own Next.js portfolio in minutes.',
+ image: 'https://assets.vercel.com/image/upload/q_auto/front/vercel/dps.png',
}
- render() {
- const meta = {
- title: 'Next.js Blog Starter Kit',
- description: 'Clone and deploy your own Next.js portfolio in minutes.',
- image:
- 'https://assets.vercel.com/image/upload/q_auto/front/vercel/dps.png',
- }
-
- return (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- )
- }
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ )
}
-
-export default MyDocument
diff --git a/examples/cms-contentful/pages/_document.js b/examples/cms-contentful/pages/_document.js
index c55951c0d5daff..54e8bf3e2a2901 100644
--- a/examples/cms-contentful/pages/_document.js
+++ b/examples/cms-contentful/pages/_document.js
@@ -1,15 +1,13 @@
-import Document, { Html, Head, Main, NextScript } from 'next/document'
+import { Html, Head, Main, NextScript } from 'next/document'
-export default class MyDocument extends Document {
- render() {
- return (
-
-
-
-
-
-
- )
- }
+export default function Document() {
+ return (
+
+
+
+
+
+
+ )
}
diff --git a/examples/cms-cosmic/pages/_document.js b/examples/cms-cosmic/pages/_document.js
index c55951c0d5daff..54e8bf3e2a2901 100644
--- a/examples/cms-cosmic/pages/_document.js
+++ b/examples/cms-cosmic/pages/_document.js
@@ -1,15 +1,13 @@
-import Document, { Html, Head, Main, NextScript } from 'next/document'
+import { Html, Head, Main, NextScript } from 'next/document'
-export default class MyDocument extends Document {
- render() {
- return (
-
-
-
-
-
-
- )
- }
+export default function Document() {
+ return (
+
+
+
+
+
+
+ )
}
diff --git a/examples/cms-datocms/pages/_document.js b/examples/cms-datocms/pages/_document.js
index c55951c0d5daff..54e8bf3e2a2901 100644
--- a/examples/cms-datocms/pages/_document.js
+++ b/examples/cms-datocms/pages/_document.js
@@ -1,15 +1,13 @@
-import Document, { Html, Head, Main, NextScript } from 'next/document'
+import { Html, Head, Main, NextScript } from 'next/document'
-export default class MyDocument extends Document {
- render() {
- return (
-
-
-
-
-
-
- )
- }
+export default function Document() {
+ return (
+
+
+
+
+
+
+ )
}
diff --git a/examples/cms-drupal/pages/_document.js b/examples/cms-drupal/pages/_document.js
index c55951c0d5daff..54e8bf3e2a2901 100644
--- a/examples/cms-drupal/pages/_document.js
+++ b/examples/cms-drupal/pages/_document.js
@@ -1,15 +1,13 @@
-import Document, { Html, Head, Main, NextScript } from 'next/document'
+import { Html, Head, Main, NextScript } from 'next/document'
-export default class MyDocument extends Document {
- render() {
- return (
-
-
-
-
-
-
- )
- }
+export default function Document() {
+ return (
+
+
+
+
+
+
+ )
}
diff --git a/examples/cms-ghost/pages/_document.js b/examples/cms-ghost/pages/_document.js
index c55951c0d5daff..54e8bf3e2a2901 100644
--- a/examples/cms-ghost/pages/_document.js
+++ b/examples/cms-ghost/pages/_document.js
@@ -1,15 +1,13 @@
-import Document, { Html, Head, Main, NextScript } from 'next/document'
+import { Html, Head, Main, NextScript } from 'next/document'
-export default class MyDocument extends Document {
- render() {
- return (
-
-
-
-
-
-
- )
- }
+export default function Document() {
+ return (
+
+
+
+
+
+
+ )
}
diff --git a/examples/cms-graphcms/pages/_document.js b/examples/cms-graphcms/pages/_document.js
index c55951c0d5daff..54e8bf3e2a2901 100644
--- a/examples/cms-graphcms/pages/_document.js
+++ b/examples/cms-graphcms/pages/_document.js
@@ -1,15 +1,13 @@
-import Document, { Html, Head, Main, NextScript } from 'next/document'
+import { Html, Head, Main, NextScript } from 'next/document'
-export default class MyDocument extends Document {
- render() {
- return (
-
-
-
-
-
-
- )
- }
+export default function Document() {
+ return (
+
+
+
+
+
+
+ )
}
diff --git a/examples/cms-kontent/pages/_document.js b/examples/cms-kontent/pages/_document.js
index c55951c0d5daff..54e8bf3e2a2901 100644
--- a/examples/cms-kontent/pages/_document.js
+++ b/examples/cms-kontent/pages/_document.js
@@ -1,15 +1,13 @@
-import Document, { Html, Head, Main, NextScript } from 'next/document'
+import { Html, Head, Main, NextScript } from 'next/document'
-export default class MyDocument extends Document {
- render() {
- return (
-
-
-
-
-
-
- )
- }
+export default function Document() {
+ return (
+
+
+
+
+
+
+ )
}
diff --git a/examples/cms-prepr/pages/_document.js b/examples/cms-prepr/pages/_document.js
index c55951c0d5daff..54e8bf3e2a2901 100644
--- a/examples/cms-prepr/pages/_document.js
+++ b/examples/cms-prepr/pages/_document.js
@@ -1,15 +1,13 @@
-import Document, { Html, Head, Main, NextScript } from 'next/document'
+import { Html, Head, Main, NextScript } from 'next/document'
-export default class MyDocument extends Document {
- render() {
- return (
-
-
-
-
-
-
- )
- }
+export default function Document() {
+ return (
+
+
+
+
+
+
+ )
}
diff --git a/examples/cms-prismic/pages/_document.js b/examples/cms-prismic/pages/_document.js
index c55951c0d5daff..54e8bf3e2a2901 100644
--- a/examples/cms-prismic/pages/_document.js
+++ b/examples/cms-prismic/pages/_document.js
@@ -1,15 +1,13 @@
-import Document, { Html, Head, Main, NextScript } from 'next/document'
+import { Html, Head, Main, NextScript } from 'next/document'
-export default class MyDocument extends Document {
- render() {
- return (
-
-
-
-
-
-
- )
- }
+export default function Document() {
+ return (
+
+
+
+
+
+
+ )
}
diff --git a/examples/cms-sanity/pages/_document.js b/examples/cms-sanity/pages/_document.js
index c55951c0d5daff..54e8bf3e2a2901 100644
--- a/examples/cms-sanity/pages/_document.js
+++ b/examples/cms-sanity/pages/_document.js
@@ -1,15 +1,13 @@
-import Document, { Html, Head, Main, NextScript } from 'next/document'
+import { Html, Head, Main, NextScript } from 'next/document'
-export default class MyDocument extends Document {
- render() {
- return (
-
-
-
-
-
-
- )
- }
+export default function Document() {
+ return (
+
+
+
+
+
+
+ )
}
diff --git a/examples/cms-storyblok/pages/_document.js b/examples/cms-storyblok/pages/_document.js
index c55951c0d5daff..54e8bf3e2a2901 100644
--- a/examples/cms-storyblok/pages/_document.js
+++ b/examples/cms-storyblok/pages/_document.js
@@ -1,15 +1,13 @@
-import Document, { Html, Head, Main, NextScript } from 'next/document'
+import { Html, Head, Main, NextScript } from 'next/document'
-export default class MyDocument extends Document {
- render() {
- return (
-
-
-
-
-
-
- )
- }
+export default function Document() {
+ return (
+
+
+
+
+
+
+ )
}
diff --git a/examples/cms-strapi/pages/_document.js b/examples/cms-strapi/pages/_document.js
index c55951c0d5daff..54e8bf3e2a2901 100644
--- a/examples/cms-strapi/pages/_document.js
+++ b/examples/cms-strapi/pages/_document.js
@@ -1,15 +1,13 @@
-import Document, { Html, Head, Main, NextScript } from 'next/document'
+import { Html, Head, Main, NextScript } from 'next/document'
-export default class MyDocument extends Document {
- render() {
- return (
-
-
-
-
-
-
- )
- }
+export default function Document() {
+ return (
+
+
+
+
+
+
+ )
}
diff --git a/examples/cms-takeshape/pages/_document.js b/examples/cms-takeshape/pages/_document.js
index c55951c0d5daff..54e8bf3e2a2901 100644
--- a/examples/cms-takeshape/pages/_document.js
+++ b/examples/cms-takeshape/pages/_document.js
@@ -1,15 +1,13 @@
-import Document, { Html, Head, Main, NextScript } from 'next/document'
+import { Html, Head, Main, NextScript } from 'next/document'
-export default class MyDocument extends Document {
- render() {
- return (
-
-
-
-
-
-
- )
- }
+export default function Document() {
+ return (
+
+
+
+
+
+
+ )
}
diff --git a/examples/cms-tina/pages/_document.js b/examples/cms-tina/pages/_document.js
index c55951c0d5daff..54e8bf3e2a2901 100644
--- a/examples/cms-tina/pages/_document.js
+++ b/examples/cms-tina/pages/_document.js
@@ -1,15 +1,13 @@
-import Document, { Html, Head, Main, NextScript } from 'next/document'
+import { Html, Head, Main, NextScript } from 'next/document'
-export default class MyDocument extends Document {
- render() {
- return (
-
-
-
-
-
-
- )
- }
+export default function Document() {
+ return (
+
+
+
+
+
+
+ )
}
diff --git a/examples/cms-umbraco-heartcore/pages/_document.js b/examples/cms-umbraco-heartcore/pages/_document.js
index c55951c0d5daff..54e8bf3e2a2901 100755
--- a/examples/cms-umbraco-heartcore/pages/_document.js
+++ b/examples/cms-umbraco-heartcore/pages/_document.js
@@ -1,15 +1,13 @@
-import Document, { Html, Head, Main, NextScript } from 'next/document'
+import { Html, Head, Main, NextScript } from 'next/document'
-export default class MyDocument extends Document {
- render() {
- return (
-
-
-
-
-
-
- )
- }
+export default function Document() {
+ return (
+
+
+
+
+
+
+ )
}
diff --git a/examples/cms-wordpress/pages/_document.tsx b/examples/cms-wordpress/pages/_document.tsx
index c55951c0d5daff..54e8bf3e2a2901 100644
--- a/examples/cms-wordpress/pages/_document.tsx
+++ b/examples/cms-wordpress/pages/_document.tsx
@@ -1,15 +1,13 @@
-import Document, { Html, Head, Main, NextScript } from 'next/document'
+import { Html, Head, Main, NextScript } from 'next/document'
-export default class MyDocument extends Document {
- render() {
- return (
-
-
-
-
-
-
- )
- }
+export default function Document() {
+ return (
+
+
+
+
+
+
+ )
}
diff --git a/examples/with-babel-macros/pages/_document.js b/examples/with-babel-macros/pages/_document.js
index dfbe440013fd10..eb39cf4e4fda00 100644
--- a/examples/with-babel-macros/pages/_document.js
+++ b/examples/with-babel-macros/pages/_document.js
@@ -1,17 +1,15 @@
-import Document, { Html, Head, Main, NextScript } from 'next/document'
+import { Html, Head, Main, NextScript } from 'next/document'
-export default class MyDocument extends Document {
- render() {
- return (
-
-
-
-
-
-
-
-
-
- )
- }
+export default function Document({ css }) {
+ return (
+
+
+
+
+
+
+
+
+
+ )
}
diff --git a/examples/with-facebook-pixel/pages/_document.js b/examples/with-facebook-pixel/pages/_document.js
index b3a330dbcba71b..9a42bc679a515d 100644
--- a/examples/with-facebook-pixel/pages/_document.js
+++ b/examples/with-facebook-pixel/pages/_document.js
@@ -1,25 +1,23 @@
-import Document, { Html, Head, Main, NextScript } from 'next/document'
+import { Html, Head, Main, NextScript } from 'next/document'
import { FB_PIXEL_ID } from '../lib/fpixel'
-export default class MyDocument extends Document {
- render() {
- return (
-
-
-
-
-
-
-
-
-
- )
- }
+export default function Document() {
+ return (
+
+
+
+
+
+
+
+
+
+ )
}
diff --git a/examples/with-google-analytics-amp/pages/_document.js b/examples/with-google-analytics-amp/pages/_document.js
index 0f8dc4abb0c40b..c09f43433d5c40 100644
--- a/examples/with-google-analytics-amp/pages/_document.js
+++ b/examples/with-google-analytics-amp/pages/_document.js
@@ -1,4 +1,4 @@
-import Document, { Html, Head, Main, NextScript } from 'next/document'
+import { Html, Head, Main, NextScript } from 'next/document'
import { useAmp } from 'next/amp'
import { GA_TRACKING_ID } from '../lib/gtag'
@@ -10,63 +10,61 @@ function AmpWrap({ ampOnly, nonAmp }) {
return !isAmp && nonAmp
}
-export default class MyDocument extends Document {
- render() {
- return (
-
-
-
-
+export default function Document() {
+ return (
+
+
+
+
- {/* AMP - Google Analytics */}
-
- }
- />
+ },
+ }}
+ />
+ }
+ />
- {/* Non-AMP - Google Analytics */}
-
-
-