![]() Server : Apache/2 System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gositeme ( 1004) PHP Version : 8.2.29 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/gositeme/domains/lavocat.quebec/private_html/scripts/ |
import { execSync } from 'child_process';
import fs from 'fs';
import path from 'path';
console.log('๐งช Testing Open Graph Meta Tags Implementation...\n');
// Test 1: Check if OpenGraphMeta component exists
console.log('1. Checking OpenGraphMeta component...');
const openGraphMetaPath = path.join(process.cwd(), 'src', 'components', 'OpenGraphMeta.tsx');
if (fs.existsSync(openGraphMetaPath)) {
console.log('โ
OpenGraphMeta component exists');
const content = fs.readFileSync(openGraphMetaPath, 'utf8');
const hasRequiredProps = content.includes('title') &&
content.includes('description') &&
content.includes('url') &&
content.includes('og:title') &&
content.includes('og:description') &&
content.includes('og:url') &&
content.includes('twitter:card');
if (hasRequiredProps) {
console.log('โ
OpenGraphMeta component has all required props and meta tags');
} else {
console.log('โ OpenGraphMeta component missing required props or meta tags');
}
} else {
console.log('โ OpenGraphMeta component not found');
}
// Test 2: Check public case detail page integration
console.log('\n2. Checking public case detail page integration...');
const publicCasePagePath = path.join(process.cwd(), 'src', 'pages', 'public', 'cases', '[id].tsx');
if (fs.existsSync(publicCasePagePath)) {
console.log('โ
Public case detail page exists');
const content = fs.readFileSync(publicCasePagePath, 'utf8');
const hasOpenGraphImport = content.includes("import OpenGraphMeta from '../../../components/OpenGraphMeta'");
const hasOpenGraphUsage = content.includes('<OpenGraphMeta');
if (hasOpenGraphImport && hasOpenGraphUsage) {
console.log('โ
OpenGraphMeta integrated in public case detail page');
} else {
console.log('โ OpenGraphMeta not properly integrated in public case detail page');
}
} else {
console.log('โ Public case detail page not found');
}
// Test 3: Check user profile page integration
console.log('\n3. Checking user profile page integration...');
const profilePagePath = path.join(process.cwd(), 'src', 'pages', 'profile', '[username].tsx');
if (fs.existsSync(profilePagePath)) {
console.log('โ
User profile page exists');
const content = fs.readFileSync(profilePagePath, 'utf8');
const hasOpenGraphImport = content.includes("import OpenGraphMeta from '../../components/OpenGraphMeta'");
const hasOpenGraphUsage = content.includes('<OpenGraphMeta');
if (hasOpenGraphImport && hasOpenGraphUsage) {
console.log('โ
OpenGraphMeta integrated in user profile page');
} else {
console.log('โ OpenGraphMeta not properly integrated in user profile page');
}
} else {
console.log('โ User profile page not found');
}
// Test 4: Check live cases page integration
console.log('\n4. Checking live cases page integration...');
const liveCasesPagePath = path.join(process.cwd(), 'src', 'pages', 'live-cases.tsx');
if (fs.existsSync(liveCasesPagePath)) {
console.log('โ
Live cases page exists');
const content = fs.readFileSync(liveCasesPagePath, 'utf8');
const hasOpenGraphImport = content.includes("import OpenGraphMeta from '../components/OpenGraphMeta'");
const hasOpenGraphUsage = content.includes('<OpenGraphMeta');
if (hasOpenGraphImport && hasOpenGraphUsage) {
console.log('โ
OpenGraphMeta integrated in live cases page');
} else {
console.log('โ OpenGraphMeta not properly integrated in live cases page');
}
} else {
console.log('โ Live cases page not found');
}
// Test 5: Check for proper meta tag structure
console.log('\n5. Checking meta tag structure...');
const openGraphContent = fs.readFileSync(openGraphMetaPath, 'utf8');
const hasBasicMeta = openGraphContent.includes('<meta name="description"');
const hasOpenGraphMeta = openGraphContent.includes('<meta property="og:title"') &&
openGraphContent.includes('<meta property="og:description"') &&
openGraphContent.includes('<meta property="og:url"') &&
openGraphContent.includes('<meta property="og:type"');
const hasTwitterMeta = openGraphContent.includes('<meta name="twitter:card"') &&
openGraphContent.includes('<meta name="twitter:title"') &&
openGraphContent.includes('<meta name="twitter:description"');
const hasCanonical = openGraphContent.includes('<link rel="canonical"');
if (hasBasicMeta && hasOpenGraphMeta && hasTwitterMeta && hasCanonical) {
console.log('โ
All required meta tag types are present');
} else {
console.log('โ Missing required meta tag types');
if (!hasBasicMeta) console.log(' - Missing basic meta tags');
if (!hasOpenGraphMeta) console.log(' - Missing Open Graph meta tags');
if (!hasTwitterMeta) console.log(' - Missing Twitter Card meta tags');
if (!hasCanonical) console.log(' - Missing canonical URL');
}
// Test 6: Check for dynamic content handling
console.log('\n6. Checking dynamic content handling...');
const hasDynamicTitle = openGraphContent.includes('title={title}');
const hasDynamicDescription = openGraphContent.includes('description={description}');
const hasDynamicUrl = openGraphContent.includes('url={url}');
const hasImageHandling = openGraphContent.includes('image') && openGraphContent.includes('fullImage');
if (hasDynamicTitle && hasDynamicDescription && hasDynamicUrl && hasImageHandling) {
console.log('โ
Dynamic content handling is properly implemented');
} else {
console.log('โ Dynamic content handling is incomplete');
}
// Test 7: Check for proper URL handling
console.log('\n7. Checking URL handling...');
const hasUrlProcessing = openGraphContent.includes('fullUrl') &&
openGraphContent.includes('startsWith(\'http\')') &&
openGraphContent.includes('process.env.NEXT_PUBLIC_APP_URL');
if (hasUrlProcessing) {
console.log('โ
URL processing handles both relative and absolute URLs');
} else {
console.log('โ URL processing may not handle all URL types correctly');
}
console.log('\n๐ Open Graph Meta Tags Testing Complete!');
console.log('\n๐ Summary:');
console.log('- OpenGraphMeta component created with comprehensive meta tag support');
console.log('- Integrated into public case detail pages');
console.log('- Integrated into user profile pages');
console.log('- Integrated into live cases feed page');
console.log('- Supports dynamic content and proper URL handling');
console.log('- Includes Facebook Open Graph, Twitter Cards, and basic SEO meta tags');
console.log('\n๐ Next Steps:');
console.log('1. Test the pages in a browser to verify meta tags are rendered');
console.log('2. Use Facebook Sharing Debugger to test previews');
console.log('3. Use Twitter Card Validator to test Twitter previews');
console.log('4. Consider adding structured data (JSON-LD) for enhanced SEO');