diff --git a/src/app/(auth)/layout.tsx b/src/app/(auth)/layout.tsx new file mode 100644 index 00000000..51840533 --- /dev/null +++ b/src/app/(auth)/layout.tsx @@ -0,0 +1,23 @@ +import type { Metadata } from 'next'; + +export const metadata: Metadata = { + title: 'TeachLink - Sign In or Create an Account', + description: + 'Access your TeachLink account to continue learning offline. Sign in, sign up, or verify your email.', + openGraph: { + title: 'TeachLink - Sign In or Create an Account', + description: 'Access your TeachLink account to continue learning.', + type: 'website', + siteName: 'TeachLink', + }, + twitter: { + card: 'summary', + site: '@teachlink', + title: 'TeachLink - Sign In or Create an Account', + description: 'Access your TeachLink account to continue learning.', + }, +}; + +export default function AuthLayout({ children }: { children: React.ReactNode }) { + return <>{children}; +} diff --git a/src/app/__tests__/twitter-cards.test.ts b/src/app/__tests__/twitter-cards.test.ts new file mode 100644 index 00000000..277e40fb --- /dev/null +++ b/src/app/__tests__/twitter-cards.test.ts @@ -0,0 +1,76 @@ +import { describe, it, expect } from 'vitest'; +import { metadata as rootMetadata } from '@/app/layout'; +import { metadata as authMetadata } from '@/app/(auth)/layout'; +import { metadata as dashboardMetadata } from '@/app/dashboard/layout'; +import { metadata as profileMetadata } from '@/app/profile/layout'; + +describe('Twitter Cards metadata', () => { + describe('Root layout', () => { + it('exports a twitter card field', () => { + expect(rootMetadata.twitter).toBeDefined(); + }); + + it('uses summary_large_image card type', () => { + expect(rootMetadata.twitter?.card).toBe('summary_large_image'); + }); + + it('includes a twitter title', () => { + expect(rootMetadata.twitter?.title).toBeTruthy(); + }); + + it('includes a twitter description', () => { + expect(rootMetadata.twitter?.description).toBeTruthy(); + }); + + it('includes twitter site handle', () => { + expect(rootMetadata.twitter?.site).toBe('@teachlink'); + }); + + it('exports openGraph metadata', () => { + expect(rootMetadata.openGraph).toBeDefined(); + expect(rootMetadata.openGraph?.siteName).toBe('TeachLink'); + }); + }); + + describe('Auth layout', () => { + it('exports a twitter card field', () => { + expect(authMetadata.twitter).toBeDefined(); + }); + + it('uses summary card type', () => { + expect(authMetadata.twitter?.card).toBe('summary'); + }); + + it('includes a twitter title', () => { + expect(authMetadata.twitter?.title).toBeTruthy(); + }); + + it('includes a twitter description', () => { + expect(authMetadata.twitter?.description).toBeTruthy(); + }); + + it('includes twitter site handle', () => { + expect(authMetadata.twitter?.site).toBe('@teachlink'); + }); + }); + + describe('Dashboard layout', () => { + it('exports a twitter card field', () => { + expect(dashboardMetadata.twitter).toBeDefined(); + }); + + it('uses summary card type', () => { + expect(dashboardMetadata.twitter?.card).toBe('summary'); + }); + }); + + describe('Profile layout', () => { + it('exports a twitter card field', () => { + expect(profileMetadata.twitter).toBeDefined(); + }); + + it('uses summary card type', () => { + expect(profileMetadata.twitter?.card).toBe('summary'); + }); + }); +}); diff --git a/src/app/courses/[courseId]/page.tsx b/src/app/courses/[courseId]/page.tsx index 7545d78d..9b15f34a 100644 --- a/src/app/courses/[courseId]/page.tsx +++ b/src/app/courses/[courseId]/page.tsx @@ -12,6 +12,18 @@ export async function generateMetadata({ params }: CoursePageProps): Promise; -} +import type { Metadata } from 'next';import StudyGroupsPage from '../pages/StudyGroups';export const metadata: Metadata = { title: 'Study Groups | TeachLink', description: 'Create and collaborate in study groups with discussions, resources, and challenges.', openGraph: { title: 'Study Groups | TeachLink', description: 'Create and collaborate in study groups on TeachLink.', type: 'website', siteName: 'TeachLink', }, twitter: { card: 'summary', site: '@teachlink', title: 'Study Groups | TeachLink', description: 'Create and collaborate in study groups on TeachLink.', },};export default function Page() { return ;} \ No newline at end of file diff --git a/src/app/topics/[slug]/page.tsx b/src/app/topics/[slug]/page.tsx index 40a2d477..25f0549b 100644 --- a/src/app/topics/[slug]/page.tsx +++ b/src/app/topics/[slug]/page.tsx @@ -13,6 +13,18 @@ export async function generateMetadata({ params }: TopicPageProps): Promise