-
Notifications
You must be signed in to change notification settings - Fork 5
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
base: dev
Are you sure you want to change the base?
Ft/add next seo #1308
Changes from 3 commits
ac1337f
56218f1
1947be9
bf625e0
9621339
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { NextSeoProps } from "next-seo" | ||
export default { | ||
title: "Dacade site name", | ||
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: 1200, | ||
height: 630, | ||
alt: "DACADE", | ||
}, | ||
], | ||
}, | ||
twitter: { | ||
cardType: "summary_large_image", | ||
}, | ||
Comment on lines
+27
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
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 | ||
|
@@ -20,6 +22,7 @@ export default function MetaData({ description, title, community, testId = "meta | |
const metas = useMemo(() => getMetadataDescription(description), [description]); | ||
return ( | ||
<> | ||
<NextSeo title={title || "dacade.org"} description={description || ""} /> | ||
{title && <title data-testid="page-title">{getMetadataTitle(title, community as string)}</title>} | ||
{metas.map((meta, index) => ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification Duplicate The
🔗 Analysis chainConsider refining SEO implementation and removing potential duplication. The addition of the
Consider applying these changes: - <NextSeo title={title || "dacade.org"} description={description || ""} />
+ <NextSeo
+ title={getMetadataTitle(title || "dacade.org", community as string)}
+ description={description || "Default description of dacade.org"}
+ />
- {title && <title data-testid="page-title">{getMetadataTitle(title, community as string)}</title>} This change will:
To ensure this change doesn't break existing functionality, please run the following script: 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Verify the usage of title tags across the codebase
# Test: Search for title tags usage. Expect: No direct usage of <title> tags
rg --type tsx --type jsx '<title'
# Test: Search for NextSeo usage. Expect: Consistent usage across components
rg --type tsx --type jsx '<NextSeo'
Length of output: 129 Script: #!/bin/bash
# Description: Verify the usage of <title> tags across the codebase
# Test: Search for <title> tags in .tsx and .jsx files. Expect: Minimal or no direct usage.
rg '<title' -g '*.tsx' -g '*.jsx'
# Test: Search for <NextSeo> usage in .tsx and .jsx files. Expect: Consistent usage across components.
rg '<NextSeo' -g '*.tsx' -g '*.jsx'
Length of output: 2294 |
||
<meta data-testid={testId} key={`meta-${index}`} content={meta.content} name={meta.name} /> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Use absolute URL for OpenGraph image
The OpenGraph configuration is well-structured, but there's one potential improvement:
Consider using an absolute URL for the OpenGraph image instead of a relative one. This ensures that the image is correctly displayed when your content is shared on various platforms, regardless of the context.
Replace the relative image URL with an absolute one:
This change will make your OpenGraph image more robust across different sharing contexts.
📝 Committable suggestion