diff --git a/next-seo.config.ts b/next-seo.config.ts new file mode 100644 index 00000000..890c9018 --- /dev/null +++ b/next-seo.config.ts @@ -0,0 +1,30 @@ +import { NextSeoProps } from "next-seo" +export default { + title: "Dacade", + description: + "A peer to peer learning platform", + canonical: "https://dacade.org/", + openGraph: { + type: "website", + locale: "en", + url: "https://dacade.org/", + siteName: "Dacade", + images: [ + // { + // url: "/img/opengraph.webp", + // width: 800, + // height: 600, + // alt: "DACADE", + // }, + { + url: "/favicon.ico", + width: 800, + height: 600, + alt: "DACADE", + } + ], + }, + twitter: { + cardType: "summary_large_image", + }, +} as NextSeoProps diff --git a/package.json b/package.json index 2aaff591..4c735308 100644 --- a/package.json +++ b/package.json @@ -56,6 +56,7 @@ "next-i18next": "^13.2.2", "next-mdx-remote": "^4.4.1", "next-redux-wrapper": "^8.1.0", + "next-seo": "^6.6.0", "nextjs-progressbar": "^0.0.16", "query-string": "^8.1.0", "react": "18.2.0", diff --git a/public/img/opengraph.webp b/public/img/opengraph.webp new file mode 100644 index 00000000..c6b7459a Binary files /dev/null and b/public/img/opengraph.webp differ diff --git a/src/components/ui/MetaData.tsx b/src/components/ui/MetaData.tsx index fc39e4b8..7f9057f9 100644 --- a/src/components/ui/MetaData.tsx +++ b/src/components/ui/MetaData.tsx @@ -1,5 +1,7 @@ import { getMetadataDescription, getMetadataTitle } from "@/utilities/Metadata"; import { ReactElement, useMemo } from "react"; +import { NextSeo } from "next-seo" + /** * Meta tags component @@ -20,10 +22,12 @@ export default function MetaData({ description, title, community, testId = "meta const metas = useMemo(() => getMetadataDescription(description), [description]); return ( <> + {title && {getMetadataTitle(title, community as string)}} {metas.map((meta, index) => ( ))} + ); } diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index bbfe4369..0d0bd7f8 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -10,6 +10,8 @@ import AuthObserver from "@/contexts/AuthObserver"; import NextNProgress from "nextjs-progressbar"; import { WagmiConfig } from "wagmi"; import { config } from "@/config/Web3Modal"; +import { DefaultSeo } from "next-seo" +import SEO from "../../next-seo.config" /** * Represents a Next.js page with a custom layout. @@ -66,6 +68,7 @@ const App = ({ Component, ...rest }: AppPropsWithLayout) => { /> + )} diff --git a/yarn.lock b/yarn.lock index 5d8c37ae..f754c668 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10977,6 +10977,11 @@ next-redux-wrapper@^8.1.0: resolved "https://registry.yarnpkg.com/next-redux-wrapper/-/next-redux-wrapper-8.1.0.tgz#d9c135f1ceeb2478375bdacd356eb9db273d3a07" integrity sha512-2hIau0hcI6uQszOtrvAFqgc0NkZegKYhBB7ZAKiG3jk7zfuQb4E7OV9jfxViqqojh3SEHdnFfPkN9KErttUKuw== +next-seo@^6.6.0: + version "6.6.0" + resolved "https://registry.yarnpkg.com/next-seo/-/next-seo-6.6.0.tgz#10c6278cc3be51f9db1ede6780812e5664742974" + integrity sha512-0VSted/W6XNtgAtH3D+BZrMLLudqfm0D5DYNJRXHcDgan/1ZF1tDFIsWrmvQlYngALyphPfZ3ZdOqlKpKdvG6w== + next-tick@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.1.0.tgz#1836ee30ad56d67ef281b22bd199f709449b35eb"