From 16ff754bacc0154696aaa579786374e9c05f5dc7 Mon Sep 17 00:00:00 2001 From: Arturo Silva Date: Mon, 26 Feb 2024 23:57:07 -0500 Subject: [PATCH] fix: Playroom fix (#583) --- .../components/next-seo/defaultSeo.tsx | 60 ++++++++ .../components/next-seo/index.tsx | 2 + .../components/next-seo/nextSeo.tsx | 16 ++ build.washingtonpost.com/package.json | 1 - build.washingtonpost.com/pages/_app.js | 4 +- build.washingtonpost.com/pages/_document.js | 145 ++++++++---------- .../pages/components/[slug].js | 2 +- .../pages/foundations/[slug].js | 2 +- build.washingtonpost.com/pages/playroom.js | 4 +- .../pages/release-notes/index.js | 2 +- .../pages/resources/[category]/[slug].js | 2 +- .../pages/resources/[category]/index.js | 2 +- .../pages/resources/index.js | 2 +- .../pages/support/[slug].js | 2 +- .../pages/support/index.js | 2 +- build.washingtonpost.com/pages/zzz/[slug].js | 2 +- build.washingtonpost.com/tsconfig.json | 4 +- package-lock.json | 10 -- 18 files changed, 155 insertions(+), 109 deletions(-) create mode 100644 build.washingtonpost.com/components/next-seo/defaultSeo.tsx create mode 100644 build.washingtonpost.com/components/next-seo/index.tsx create mode 100644 build.washingtonpost.com/components/next-seo/nextSeo.tsx diff --git a/build.washingtonpost.com/components/next-seo/defaultSeo.tsx b/build.washingtonpost.com/components/next-seo/defaultSeo.tsx new file mode 100644 index 000000000..11c1de5c9 --- /dev/null +++ b/build.washingtonpost.com/components/next-seo/defaultSeo.tsx @@ -0,0 +1,60 @@ +import React from "react"; +import Head from "next/head"; + +interface SeoConfig { + defaultTitle: string; + description: string; + openGraph: { + type: string; + locale: string; + url: string; + site_name: string; + title: string; + images: // array of images + { + url: string; + width: number; + height: number; + alt: string; + }[]; + }; + twitter: { + handle: string; + site: string; + cardType: string; + url: string; + title: string; + description: string; + }; +} + +interface DefaultSeoProps { + seoConfig: SeoConfig; +} + +export const DefaultSeo: React.FC = ({ seoConfig }) => { + return ( + + {seoConfig.defaultTitle} + + + + + + + {seoConfig.openGraph.images.map((image, index) => ( + + ))} + + + + + + + + + ); +}; diff --git a/build.washingtonpost.com/components/next-seo/index.tsx b/build.washingtonpost.com/components/next-seo/index.tsx new file mode 100644 index 000000000..adbae5866 --- /dev/null +++ b/build.washingtonpost.com/components/next-seo/index.tsx @@ -0,0 +1,2 @@ +export { DefaultSeo } from "./defaultSeo"; +export { NextSeo } from "./nextSeo"; diff --git a/build.washingtonpost.com/components/next-seo/nextSeo.tsx b/build.washingtonpost.com/components/next-seo/nextSeo.tsx new file mode 100644 index 000000000..5ff8d90f6 --- /dev/null +++ b/build.washingtonpost.com/components/next-seo/nextSeo.tsx @@ -0,0 +1,16 @@ +import React from "react"; +import Head from "next/head"; + +interface pageSeoConfig { + title: string; + description: string; +} + +export const NextSeo: React.FC = ({ title, description }) => { + return ( + + {title} + + + ); +}; diff --git a/build.washingtonpost.com/package.json b/build.washingtonpost.com/package.json index d9992bb56..b2b6b141b 100644 --- a/build.washingtonpost.com/package.json +++ b/build.washingtonpost.com/package.json @@ -34,7 +34,6 @@ "lz-string": "^1.4.4", "next": "^14", "next-mdx-remote": "^4.4.1", - "next-seo": "5.15.0", "next-themes": "0.2.1", "param-case": "^3.0.4", "pascal-case": "^3.1.2", diff --git a/build.washingtonpost.com/pages/_app.js b/build.washingtonpost.com/pages/_app.js index 034564bbd..827d0e870 100644 --- a/build.washingtonpost.com/pages/_app.js +++ b/build.washingtonpost.com/pages/_app.js @@ -3,7 +3,7 @@ import React from "react"; import { ThemeProvider } from "next-themes"; import Script from "next/script"; -import { DefaultSeo } from "next-seo"; +import { DefaultSeo } from "../components/next-seo"; import "react-toastify/dist/ReactToastify.css"; import { globalStyles, @@ -87,7 +87,7 @@ function App({ Component, pageProps }) { return ( <> - + { - const css = getCssText(); - reset(); - return css; -}; +export default function Document() { + return ( + + + +