migration wip
This commit is contained in:
122
scripts/analyze-pages-detailed.js
Normal file
122
scripts/analyze-pages-detailed.js
Normal file
@@ -0,0 +1,122 @@
|
||||
const pages = require('../data/processed/pages.json');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
// Analyze each page
|
||||
const analysis = [];
|
||||
|
||||
pages.forEach(page => {
|
||||
const html = page.contentHtml || '';
|
||||
const $ = cheerio.load(html);
|
||||
|
||||
const patterns = {
|
||||
vcRows: $('.vc-row').length,
|
||||
vcColumns: $('.vc-column').length,
|
||||
hasHero: $('.vc-row h1, .vc-row h2').length > 0,
|
||||
hasCards: $('.vc-row .vc-column h3, .vc-row .vc-column h4').length >= 2,
|
||||
hasNumberedFeatures: $('.vc-row h6').length > 0,
|
||||
hasForm: $('.frm_forms').length > 0 || $('form').length > 0,
|
||||
hasGrid: $('.vc-row > .vc-column').length >= 2,
|
||||
hasImages: $('img').length,
|
||||
hasLinks: $('a').length,
|
||||
hasTables: $('table').length,
|
||||
hasLists: $('ul, ol').length,
|
||||
hasTestimonials: $('.vc-row').filter((i, el) => {
|
||||
const text = $(el).text();
|
||||
return text.includes('„') || text.includes('“') || text.includes('Meet the team');
|
||||
}).length,
|
||||
hasAnimations: $('.vc-row').filter((i, el) => {
|
||||
const classes = $(el).attr('class') || '';
|
||||
return classes.includes('nectar') || classes.includes('animation') || classes.includes('fade');
|
||||
}).length,
|
||||
hasSpecialColumns: $('.vc-row > .vc-column').filter((i, el) => {
|
||||
const classes = $(el).attr('class') || '';
|
||||
return classes.includes('vc_col-md-') || classes.includes('vc_col-lg-');
|
||||
}).length,
|
||||
hasNestedRows: $('.vc-row .vc-row').length,
|
||||
hasBackgrounds: $('.vc-row').filter((i, el) => {
|
||||
const style = $(el).attr('style') || '';
|
||||
const classes = $(el).attr('class') || '';
|
||||
return style.includes('background') || classes.includes('bg-') || classes.includes('full-width');
|
||||
}).length,
|
||||
hasQuotes: $('blockquote, h2').filter((i, el) => {
|
||||
const text = $(el).text();
|
||||
return text.includes('„') || text.includes('“') || text.includes('Expertise') || text.includes('Experience');
|
||||
}).length,
|
||||
hasPDFs: $('a[href$=".pdf"]').length,
|
||||
hasContactInfo: $('.vc-row').filter((i, el) => {
|
||||
const text = $(el).text();
|
||||
return text.includes('@') || text.includes('Raiffeisenstraße') || text.includes('KLZ Cables');
|
||||
}).length
|
||||
};
|
||||
|
||||
analysis.push({
|
||||
slug: page.slug,
|
||||
locale: page.locale,
|
||||
translationKey: page.translationKey,
|
||||
title: page.title,
|
||||
patterns: patterns,
|
||||
rawHtml: html.substring(0, 200) + '...'
|
||||
});
|
||||
});
|
||||
|
||||
// Print detailed analysis
|
||||
console.log('=== DETAILED PAGE ANALYSIS ===\n');
|
||||
|
||||
analysis.forEach(page => {
|
||||
console.log(`📄 ${page.locale.toUpperCase()}: ${page.slug} (${page.title})`);
|
||||
console.log(` Translation Key: ${page.translationKey}`);
|
||||
console.log(' Patterns Found:');
|
||||
|
||||
Object.entries(page.patterns).forEach(([key, value]) => {
|
||||
if (value > 0) {
|
||||
console.log(` - ${key}: ${value}`);
|
||||
}
|
||||
});
|
||||
|
||||
console.log('');
|
||||
});
|
||||
|
||||
// Summary by translation key
|
||||
console.log('=== SUMMARY BY TRANSLATION KEY ===\n');
|
||||
const byKey = {};
|
||||
analysis.forEach(page => {
|
||||
if (!byKey[page.translationKey]) {
|
||||
byKey[page.translationKey] = [];
|
||||
}
|
||||
byKey[page.translationKey].push(page);
|
||||
});
|
||||
|
||||
Object.keys(byKey).sort().forEach(key => {
|
||||
const pages = byKey[key];
|
||||
console.log(`${key}:`);
|
||||
pages.forEach(p => {
|
||||
const patterns = Object.entries(p.patterns).filter(([k, v]) => v > 0).map(([k, v]) => `${k}=${v}`).join(', ');
|
||||
console.log(` ${p.locale}: ${p.slug} [${patterns}]`);
|
||||
});
|
||||
console.log('');
|
||||
});
|
||||
|
||||
// Priority analysis
|
||||
console.log('=== PRIORITY PAGES ANALYSIS ===\n');
|
||||
|
||||
const priority = {
|
||||
'Home': ['corporate-3-landing-2', 'start'],
|
||||
'Contact': ['contact', 'kontakt'],
|
||||
'About/Legal/Privacy': ['legal-notice', 'impressum', 'privacy-policy', 'datenschutz', 'terms', 'agbs'],
|
||||
'Team': ['team'],
|
||||
'Products': ['products', 'produkte'],
|
||||
'Blog': ['blog'],
|
||||
'Thanks': ['thanks', 'danke']
|
||||
};
|
||||
|
||||
Object.keys(priority).forEach(category => {
|
||||
console.log(`${category}:`);
|
||||
priority[category].forEach(slug => {
|
||||
const page = analysis.find(p => p.slug === slug);
|
||||
if (page) {
|
||||
const patterns = Object.entries(page.patterns).filter(([k, v]) => v > 0).map(([k, v]) => `${k}=${v}`).join(', ');
|
||||
console.log(` ${page.locale}/${page.slug}: ${patterns || 'No patterns'}`);
|
||||
}
|
||||
});
|
||||
console.log('');
|
||||
});
|
||||
Reference in New Issue
Block a user