import CourseCard1 from '@/components/cards/course-card-1'; import TableFooter from '@/components/table/table-footer'; import { getQueryParams } from '@/lib/route'; import { cn } from '@/lib/utils'; import { SharedData } from '@/types/global'; import { Head, usePage } from '@inertiajs/react'; import { ReactNode } from 'react'; import Layout from './layout'; export interface CoursesIndexProps extends SharedData { levels: string[]; prices: string[]; expiries: string[]; category?: CourseCategory; categoryChild?: CourseCategoryChild; courses: Pagination; categories: CourseCategory[]; wishlists: CourseWishlist[]; } const Index = (props: CoursesIndexProps) => { const { url } = usePage(); const { courses, wishlists, category, categoryChild, system, translate } = props; const { frontend } = translate; const urlParams = getQueryParams(url); // Generate meta information based on category const siteName = system?.fields?.name || 'Mentor Learning Management System'; const totalCourses = courses?.total || 0; const siteUrl = url; const siteOrigin = typeof window !== 'undefined' ? window.location.origin : url.split('/').slice(0, 3).join('/'); let pageTitle = category ? category.title : 'All'; let pageDescription = `Browse ${totalCourses}+ online courses from expert instructors. Learn new skills with our comprehensive course catalog.`; let pageKeywords = 'online courses, learning platform, education, skills, training, e-learning'; let ogTitle = frontend.all_courses; if (category && categoryChild) { pageTitle = `${categoryChild.title} Courses in ${category.title}`; ogTitle = `${categoryChild.title} - ${category.title} Courses`; pageDescription = `Learn ${categoryChild.title.toLowerCase()} with ${totalCourses} specialized courses in ${category.title.toLowerCase()}. Expert instructors, practical projects, and industry-relevant curriculum.`; pageKeywords = `${categoryChild.title.toLowerCase()}, ${category.title.toLowerCase()}, courses, training, ${categoryChild.title} certification, ${category.title} skills`; } else if (category) { pageTitle = `${category.title} Courses`; ogTitle = `${category.title} Courses`; pageDescription = `Explore ${totalCourses} ${category.title.toLowerCase()} courses taught by industry experts. Master ${category.title.toLowerCase()} skills with hands-on projects and comprehensive curriculum.`; pageKeywords = `${category.title.toLowerCase()}, courses, training, online learning, ${category.title} certification, ${category.title} skills`; } const fullTitle = `${pageTitle} | ${siteName}`; const courseImage = courses?.data?.[0]?.thumbnail; const categoryImage = category?.thumbnail || courseImage; return ( <> {fullTitle} {/* Open Graph Tags */} {/* Open Graph Image */} {/* Twitter Card Tags */} {/* Category-specific meta */} {category && } {category && } {categoryChild && } {/* Schema.org structured data */}
{courses.data.map((course) => ( ))}
); }; Index.layout = (page: ReactNode) => ; export default Index;