-
-
Notifications
You must be signed in to change notification settings - Fork 79
Enhance SEO metadata and add structured data for better discoverability #140
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
base: main
Are you sure you want to change the base?
Changes from all commits
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 |
|---|---|---|
|
|
@@ -8,15 +8,35 @@ const inter = Inter({ subsets: ["latin"] }) | |
|
|
||
| export const metadata: Metadata = { | ||
| title: "Perspective - AI-Powered Bias Detection", | ||
| description: "Combat bias and one-sided narratives with AI-generated alternative perspectives.", | ||
| description: | ||
| "Combat bias and one-sided narratives with AI-generated alternative perspectives. Perspective analyzes text and provides balanced viewpoints using AI.", | ||
| keywords: [ | ||
| "AI bias detection", | ||
| "AI perspective analysis", | ||
| "bias detection tool", | ||
| "AI content evaluation", | ||
| "alternative narrative generation", | ||
| ], | ||
| openGraph: { | ||
| title: "Perspective - AI-Powered Bias Detection", | ||
| description: | ||
| "Analyze content for bias and generate alternative AI-driven perspectives.", | ||
| url: "https://perspective-aossie.vercel.app/", | ||
| siteName: "Perspective", | ||
| type: "website", | ||
| }, | ||
| twitter: { | ||
| card: "summary_large_image", | ||
| title: "Perspective - AI-Powered Bias Detection", | ||
| description: | ||
| "AI-powered tool to analyze bias and generate alternative perspectives.", | ||
| }, | ||
| } | ||
|
|
||
| /** | ||
| * Root layout component that sets up global HTML structure, font, and theming for the application. | ||
| * | ||
| * Wraps all page content with the Inter font and a theme provider supporting system-based theming. | ||
| * | ||
| * @param children - The content to be rendered within the layout. | ||
| */ | ||
| export default function RootLayout({ | ||
| children, | ||
|
|
@@ -26,10 +46,31 @@ export default function RootLayout({ | |
| return ( | ||
| <html lang="en" suppressHydrationWarning> | ||
| <body className={inter.className}> | ||
| <ThemeProvider attribute="class" defaultTheme="system" enableSystem disableTransitionOnChange={false}> | ||
| <ThemeProvider | ||
| attribute="class" | ||
| defaultTheme="system" | ||
| enableSystem | ||
| disableTransitionOnChange={false} | ||
| > | ||
| {/* Structured Data for AI & Search Engines */} | ||
| <script | ||
| type="application/ld+json" | ||
| dangerouslySetInnerHTML={{ | ||
| __html: JSON.stringify({ | ||
| "@context": "https://schema.org", | ||
| "@type": "SoftwareApplication", | ||
| name: "Perspective", | ||
| applicationCategory: "AIApplication", | ||
| description: | ||
| "Perspective is an AI-powered tool that detects bias in text and generates alternative perspectives.", | ||
| operatingSystem: "Web", | ||
| url: "https://perspective-aossie.vercel.app/", | ||
| }), | ||
| }} | ||
| /> | ||
|
Comment on lines
+56
to
+70
Contributor
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. 🧩 Analysis chain🏁 Script executed: # First, let's confirm the file exists and view the actual code at lines 56-70
cat -n frontend/app/layout.tsx | sed -n '56,70p'Repository: AOSSIE-Org/Perspective Length of output: 793 🌐 Web query:
💡 Result:
If you care specifically about Google Software App rich results, Google says the value “must be a supported app type” and provides this supported list: Sources: 🌐 Web query:
💡 Result: Google’s Software app rich result is based on Schema.org’s Required (Google rich result eligibility)
Recommended (improves/clarifies results)
Notes
Sources: Google Search Central “Software app (
Google Rich Results eligibility: To qualify for Google's software app rich results, the schema must include ✏️ Suggested fix- applicationCategory: "AIApplication",
+ applicationCategory: "UtilitiesApplication",Also add required properties for Google Rich Results: offers: {
+ price: "0",
+ priceCurrency: "USD"
},And one of: + aggregateRating: {
+ "@type": "AggregateRating",
+ ratingValue: "4.5",
+ ratingCount: "10"
+ }🧰 Tools🪛 ast-grep (0.40.5)[warning] 57-57: Usage of dangerouslySetInnerHTML detected. This bypasses React's built-in XSS protection. Always sanitize HTML content using libraries like DOMPurify before injecting it into the DOM to prevent XSS attacks. (react-unsafe-html-injection) 🤖 Prompt for AI Agents |
||
| {children} | ||
| </ThemeProvider> | ||
| </body> | ||
| </html> | ||
| ) | ||
| } | ||
| } | ||
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.
summary_large_imagecard type without animagesproperty will render poorly on social platforms.Both
openGraphandtwittermetadata are missingimages. Thesummary_large_imagecard type features a large, full-width prominent image alongside a tweet and is designed to give the reader a rich photo experience. Without providingtwitter:image, "Twitter says that the image should be unique to the page, but if you don't include an image, the card they produce has a silly-looking icon on it (of a scroll or document)." Similarly, OG shares on LinkedIn, Slack, and other platforms will display no visual thumbnail.The suggested minimum properties for the
Summary Card with Large Imageinclude title, description, and image.Either add
imagesarrays to bothopenGraphandtwitter, or downgrade the Twitter card to"summary"if no image is available yet.🖼️ Proposed fix — add images or downgrade Twitter card type
openGraph: { title: "Perspective - AI-Powered Bias Detection", description: "Analyze content for bias and generate alternative AI-driven perspectives.", url: "https://perspective-aossie.vercel.app/", siteName: "Perspective", type: "website", + images: [ + { + url: "https://perspective-aossie.vercel.app/og-image.png", + width: 1200, + height: 630, + alt: "Perspective - AI-Powered Bias Detection", + }, + ], }, twitter: { - card: "summary_large_image", + card: "summary", // upgrade to "summary_large_image" once a twitter:image is available title: "Perspective - AI-Powered Bias Detection", description: "AI-powered tool to analyze bias and generate alternative perspectives.", },📝 Committable suggestion
🤖 Prompt for AI Agents