Implement Stage 3: Enhance content generation and metadata features
- Updated AI prompts to include metadata context, cluster roles, and product attributes for improved content generation. - Enhanced GenerateContentFunction to incorporate taxonomy and keyword objects for richer context. - Introduced new metadata fields in frontend components for better content organization and filtering. - Added cluster match, taxonomy match, and relevance score to LinkResults for improved link management. - Implemented metadata completeness scoring and recommended actions in AnalysisPreview for better content optimization. - Updated API services to support new metadata structures and site progress tracking.
This commit is contained in:
@@ -108,6 +108,74 @@ export default function AnalysisPreview() {
|
||||
{/* Scores */}
|
||||
<OptimizationScores scores={scores} />
|
||||
|
||||
{/* Stage 3: Cluster Dimension Scorecards */}
|
||||
{(scores.has_cluster_mapping || scores.has_taxonomy_mapping || scores.has_attributes) && (
|
||||
<div className="bg-white dark:bg-gray-800 rounded-lg shadow p-6">
|
||||
<h3 className="text-lg font-semibold text-gray-900 dark:text-white mb-4">Metadata Coverage</h3>
|
||||
<div className="grid grid-cols-1 md:grid-cols-3 gap-4">
|
||||
<div className={`p-4 rounded-lg border-2 ${
|
||||
scores.has_cluster_mapping
|
||||
? 'border-green-500 bg-green-50 dark:bg-green-900/20'
|
||||
: 'border-red-500 bg-red-50 dark:bg-red-900/20'
|
||||
}`}>
|
||||
<div className="flex items-center justify-between mb-2">
|
||||
<span className="text-sm font-medium text-gray-700 dark:text-gray-300">Cluster Mapping</span>
|
||||
{scores.has_cluster_mapping ? (
|
||||
<span className="text-green-600 dark:text-green-400">✓</span>
|
||||
) : (
|
||||
<span className="text-red-600 dark:text-red-400">✗</span>
|
||||
)}
|
||||
</div>
|
||||
<div className="text-xs text-gray-600 dark:text-gray-400">
|
||||
{scores.has_cluster_mapping
|
||||
? 'Content is mapped to cluster'
|
||||
: 'Missing cluster mapping'}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className={`p-4 rounded-lg border-2 ${
|
||||
scores.has_taxonomy_mapping
|
||||
? 'border-green-500 bg-green-50 dark:bg-green-900/20'
|
||||
: 'border-yellow-500 bg-yellow-50 dark:bg-yellow-900/20'
|
||||
}`}>
|
||||
<div className="flex items-center justify-between mb-2">
|
||||
<span className="text-sm font-medium text-gray-700 dark:text-gray-300">Taxonomy Mapping</span>
|
||||
{scores.has_taxonomy_mapping ? (
|
||||
<span className="text-green-600 dark:text-green-400">✓</span>
|
||||
) : (
|
||||
<span className="text-yellow-600 dark:text-yellow-400">⚠</span>
|
||||
)}
|
||||
</div>
|
||||
<div className="text-xs text-gray-600 dark:text-gray-400">
|
||||
{scores.has_taxonomy_mapping
|
||||
? 'Content is mapped to taxonomy'
|
||||
: 'Taxonomy mapping recommended'}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className={`p-4 rounded-lg border-2 ${
|
||||
scores.has_attributes
|
||||
? 'border-green-500 bg-green-50 dark:bg-green-900/20'
|
||||
: 'border-yellow-500 bg-yellow-50 dark:bg-yellow-900/20'
|
||||
}`}>
|
||||
<div className="flex items-center justify-between mb-2">
|
||||
<span className="text-sm font-medium text-gray-700 dark:text-gray-300">Attributes</span>
|
||||
{scores.has_attributes ? (
|
||||
<span className="text-green-600 dark:text-green-400">✓</span>
|
||||
) : (
|
||||
<span className="text-yellow-600 dark:text-yellow-400">⚠</span>
|
||||
)}
|
||||
</div>
|
||||
<div className="text-xs text-gray-600 dark:text-gray-400">
|
||||
{scores.has_attributes
|
||||
? 'Content has attributes'
|
||||
: 'Attributes recommended for products/services'}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Score Details */}
|
||||
<div className="bg-white dark:bg-gray-800 rounded-lg shadow p-6">
|
||||
<h3 className="text-lg font-semibold text-gray-900 dark:text-white mb-4">Score Details</h3>
|
||||
@@ -140,8 +208,78 @@ export default function AnalysisPreview() {
|
||||
{scores.internal_links_count || 0}
|
||||
</span>
|
||||
</div>
|
||||
{/* Stage 3: Metadata completeness score */}
|
||||
{scores.metadata_completeness_score !== undefined && (
|
||||
<div>
|
||||
<span className="text-sm text-gray-600 dark:text-gray-400">Metadata Completeness:</span>
|
||||
<span className="ml-2 font-medium text-gray-900 dark:text-white">
|
||||
{scores.metadata_completeness_score.toFixed(1)}%
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Stage 3: Next Action Cards */}
|
||||
{(!scores.has_cluster_mapping || !scores.has_taxonomy_mapping || !scores.has_attributes || (scores.metadata_completeness_score !== undefined && scores.metadata_completeness_score < 80)) && (
|
||||
<div className="bg-white dark:bg-gray-800 rounded-lg shadow p-6">
|
||||
<h3 className="text-lg font-semibold text-gray-900 dark:text-white mb-4">Recommended Actions</h3>
|
||||
<div className="space-y-3">
|
||||
{!scores.has_cluster_mapping && (
|
||||
<div className="p-3 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg">
|
||||
<div className="flex items-start gap-2">
|
||||
<span className="text-blue-600 dark:text-blue-400 font-bold">1.</span>
|
||||
<div className="flex-1">
|
||||
<div className="font-medium text-blue-900 dark:text-blue-300">Map Content to Cluster</div>
|
||||
<div className="text-sm text-blue-700 dark:text-blue-400 mt-1">
|
||||
Assign this content to a keyword cluster to improve internal linking and SEO structure.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{!scores.has_taxonomy_mapping && (
|
||||
<div className="p-3 bg-purple-50 dark:bg-purple-900/20 border border-purple-200 dark:border-purple-800 rounded-lg">
|
||||
<div className="flex items-start gap-2">
|
||||
<span className="text-purple-600 dark:text-purple-400 font-bold">2.</span>
|
||||
<div className="flex-1">
|
||||
<div className="font-medium text-purple-900 dark:text-purple-300">Add Taxonomy Mapping</div>
|
||||
<div className="text-sm text-purple-700 dark:text-purple-400 mt-1">
|
||||
Categorize this content with a taxonomy for better organization and navigation.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{!scores.has_attributes && (content?.entity_type === 'product' || content?.entity_type === 'service') && (
|
||||
<div className="p-3 bg-orange-50 dark:bg-orange-900/20 border border-orange-200 dark:border-orange-800 rounded-lg">
|
||||
<div className="flex items-start gap-2">
|
||||
<span className="text-orange-600 dark:text-orange-400 font-bold">3.</span>
|
||||
<div className="flex-1">
|
||||
<div className="font-medium text-orange-900 dark:text-orange-300">Add Product/Service Attributes</div>
|
||||
<div className="text-sm text-orange-700 dark:text-orange-400 mt-1">
|
||||
Add attributes like specifications, features, or modifiers to enhance content completeness.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{scores.metadata_completeness_score !== undefined && scores.metadata_completeness_score < 80 && (
|
||||
<div className="p-3 bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-lg">
|
||||
<div className="flex items-start gap-2">
|
||||
<span className="text-amber-600 dark:text-amber-400 font-bold">4.</span>
|
||||
<div className="flex-1">
|
||||
<div className="font-medium text-amber-900 dark:text-amber-300">Improve Metadata Completeness</div>
|
||||
<div className="text-sm text-amber-700 dark:text-amber-400 mt-1">
|
||||
Current score: {scores.metadata_completeness_score.toFixed(1)}%. Complete missing metadata fields to reach 80%+.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
<div className="text-center py-12">
|
||||
|
||||
Reference in New Issue
Block a user