Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ft/add next seo #1308

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions next-seo.config.ts
Original file line number Diff line number Diff line change
@@ -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",
},
Comment on lines +27 to +29
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Enhance Twitter card configuration

The Twitter card type is correctly set to "summary_large_image". However, the Twitter card configuration could be more comprehensive to improve the appearance of shared content on Twitter.

Consider adding the following properties to your Twitter card configuration:

twitter: {
    handle: '@YourTwitterHandle',
    site: '@YourSiteTwitterHandle',
    cardType: 'summary_large_image',
},

These additional properties will associate the shared content with your Twitter account and improve its presentation on the platform.

} as NextSeoProps
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Binary file added public/img/opengraph.webp
Binary file not shown.
4 changes: 4 additions & 0 deletions src/components/ui/MetaData.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { getMetadataDescription, getMetadataTitle } from "@/utilities/Metadata";
import { ReactElement, useMemo } from "react";
import { NextSeo } from "next-seo"


/**
* Meta tags component
Expand All @@ -20,10 +22,12 @@ export default function MetaData({ description, title, community, testId = "meta
const metas = useMemo(() => getMetadataDescription(description), [description]);
return (
<>
<NextSeo title={getMetadataTitle(title || "Dacade.org", community as string)} description={description || ""} />
{title && <title data-testid="page-title">{getMetadataTitle(title, community as string)}</title>}
{metas.map((meta, index) => (
<meta data-testid={testId} key={`meta-${index}`} content={meta.content} name={meta.name} />
))}
<meta property="og:logo" content="/favicon.ico" />
</>
);
}
3 changes: 3 additions & 0 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -66,6 +68,7 @@ const App = ({ Component, ...rest }: AppPropsWithLayout) => {
/>

<Component {...pageProps} />
<DefaultSeo {...SEO} />
</>
)}
</AuthObserver>
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down