feat(seo): configure comprehensive SEO, rich Schema.org JSON-LD, and FAQs across all 82 tools
This commit is contained in:
+2
-1
@@ -1,7 +1,8 @@
|
||||
import { MetadataRoute } from 'next';
|
||||
import { getSiteConfig } from '@/lib/config/loader';
|
||||
|
||||
export default function robots(): MetadataRoute.Robots {
|
||||
const baseUrl = process.env.SITE_URL || 'http://localhost:3000';
|
||||
const baseUrl = (process.env.SITE_URL || getSiteConfig().seo.siteUrl || 'http://localhost:3000').replace(/\/$/, '');
|
||||
|
||||
return {
|
||||
rules: {
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
import { MetadataRoute } from 'next';
|
||||
import { getAllTools, getAllApps } from '@/lib/config/loader';
|
||||
import { getAllTools, getAllApps, getSiteConfig } from '@/lib/config/loader';
|
||||
|
||||
export default function sitemap(): MetadataRoute.Sitemap {
|
||||
const baseUrl = process.env.SITE_URL || 'http://localhost:3000';
|
||||
const baseUrl = (process.env.SITE_URL || getSiteConfig().seo.siteUrl || 'http://localhost:3000').replace(/\/$/, '');
|
||||
const now = new Date();
|
||||
|
||||
const staticPages = [
|
||||
|
||||
+176
-65
@@ -1,8 +1,7 @@
|
||||
import { Metadata } from 'next';
|
||||
import { notFound } from 'next/navigation';
|
||||
import { getAllTools, getToolBySlug, getAppById, getTemplate, getSiteConfig } from '@/lib/config/loader';
|
||||
import { getAllTools, getToolBySlug, getAppById, getTemplate, getSiteConfig, getAllCategories } from '@/lib/config/loader';
|
||||
import { getEndpointById } from '@/lib/catalog/loader';
|
||||
import { SectionRenderer } from '@/components/sections/SectionRenderer';
|
||||
import { DynamicToolWorkspace } from '@/components/tools/DynamicToolWorkspace';
|
||||
import { resolveLocalised } from '@/types';
|
||||
|
||||
@@ -19,26 +18,62 @@ export async function generateMetadata({ params }: ToolPageProps): Promise<Metad
|
||||
|
||||
const name = resolveLocalised(tool.name, 'en');
|
||||
const summary = resolveLocalised(tool.summary, 'en');
|
||||
const exampleImg = tool.content?.examples?.[0]?.after || '/brand/og-default.png';
|
||||
const cleanTitle = (tool.seo?.title || `${name} Free Online`).replace(/ \| CRE Innovations$/, '');
|
||||
const siteConfig = getSiteConfig();
|
||||
const siteUrl = (process.env.SITE_URL || siteConfig.seo.siteUrl || 'http://localhost:3000').replace(/\/$/, '');
|
||||
|
||||
const cleanTitle = (tool.seo?.title || `${name} - Free Online AI Tool`).replace(/ \| CRE Innovations$/, '');
|
||||
const description = tool.seo?.description || summary;
|
||||
const rawImg = tool.seo?.ogImage || tool.content?.examples?.[0]?.after || '/brand/og-default.png';
|
||||
const ogImgUrl = rawImg.startsWith('http') ? rawImg : `${siteUrl}${rawImg}`;
|
||||
const keywords = tool.seo?.keywords && tool.seo.keywords.length > 0
|
||||
? tool.seo.keywords
|
||||
: [name, 'free online AI tool', 'photo editor', 'CRE Innovations'];
|
||||
|
||||
return {
|
||||
title: cleanTitle,
|
||||
description: tool.seo?.description || summary,
|
||||
description: description,
|
||||
keywords: keywords,
|
||||
authors: [{ name: 'CRE Innovations Studio' }],
|
||||
creator: 'CRE Innovations',
|
||||
publisher: 'CRE Innovations',
|
||||
alternates: {
|
||||
canonical: `/tools/${tool.slug}`,
|
||||
canonical: tool.seo?.canonical ? `${siteUrl}${tool.seo.canonical}` : `${siteUrl}/tools/${tool.slug}`,
|
||||
},
|
||||
openGraph: {
|
||||
title: `${cleanTitle} | CRE Innovations`,
|
||||
description: summary,
|
||||
description: description,
|
||||
url: `${siteUrl}/tools/${tool.slug}`,
|
||||
siteName: 'CRE Innovations',
|
||||
locale: 'en_US',
|
||||
type: 'website',
|
||||
images: [{ url: exampleImg, width: 800, height: 600, alt: name }],
|
||||
images: [
|
||||
{
|
||||
url: ogImgUrl,
|
||||
width: 1200,
|
||||
height: 630,
|
||||
alt: `${cleanTitle} - Free Online AI Tool`,
|
||||
},
|
||||
],
|
||||
},
|
||||
twitter: {
|
||||
card: 'summary_large_image',
|
||||
title: `${cleanTitle} | CRE Innovations`,
|
||||
description: summary,
|
||||
images: [exampleImg],
|
||||
description: description,
|
||||
images: [ogImgUrl],
|
||||
creator: '@CREInnovations',
|
||||
site: '@CREInnovations',
|
||||
},
|
||||
robots: {
|
||||
index: tool.seo?.indexable !== false,
|
||||
follow: true,
|
||||
nocache: false,
|
||||
googleBot: {
|
||||
index: tool.seo?.indexable !== false,
|
||||
follow: true,
|
||||
'max-video-preview': -1,
|
||||
'max-image-preview': 'large',
|
||||
'max-snippet': -1,
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -48,71 +83,147 @@ export default function ToolDetailPage({ params }: ToolPageProps) {
|
||||
if (!tool) notFound();
|
||||
|
||||
const homeApp = getAppById(tool.homeApp);
|
||||
const template = getTemplate('tool') || { sections: [] };
|
||||
|
||||
const endpoint = tool.tryIt?.endpointRef?.id ? getEndpointById(tool.tryIt.endpointRef.id) : undefined;
|
||||
const variants = endpoint?.variants || [];
|
||||
|
||||
// Related tools
|
||||
const allTools = getAllTools();
|
||||
const relatedTools = (tool.related || [])
|
||||
.map((rId) => allTools.find((t) => t.id === rId))
|
||||
.filter(Boolean) as any[];
|
||||
|
||||
const context = {
|
||||
tool,
|
||||
homeApp,
|
||||
variants,
|
||||
tools: allTools,
|
||||
relatedTools,
|
||||
locale: 'en',
|
||||
};
|
||||
|
||||
const toolName = resolveLocalised(tool.name, 'en');
|
||||
const toolSummary = resolveLocalised(tool.summary, 'en');
|
||||
const siteUrl = (process.env.SITE_URL || getSiteConfig().seo.siteUrl || 'http://localhost:3000').replace(/\/$/, '');
|
||||
const exampleImg = tool.content?.examples?.[0]?.after || `${siteUrl}/brand/og-default.png`;
|
||||
const rawImg = tool.seo?.ogImage || tool.content?.examples?.[0]?.after || '/brand/og-default.png';
|
||||
const ogImgUrl = rawImg.startsWith('http') ? rawImg : `${siteUrl}${rawImg}`;
|
||||
const cleanTitle = (tool.seo?.title || `${toolName} - Free Online AI Tool`).replace(/ \| CRE Innovations$/, '');
|
||||
const seoDescription = tool.seo?.description || toolSummary;
|
||||
|
||||
// Structured Data (JSON-LD) for WebApplication and Breadcrumbs per PRD §10 SEO-07
|
||||
const structuredData = [
|
||||
{
|
||||
'@context': 'https://schema.org',
|
||||
'@type': 'WebApplication',
|
||||
name: toolName,
|
||||
description: toolSummary,
|
||||
applicationCategory: 'MultimediaApplication',
|
||||
operatingSystem: 'Any',
|
||||
image: exampleImg,
|
||||
offers: {
|
||||
'@type': 'Offer',
|
||||
price: '0',
|
||||
priceCurrency: 'USD',
|
||||
// Category mapping
|
||||
const categoryItem = getAllCategories().find((c) => c.slug === tool.category || c.id === tool.category);
|
||||
const categoryName = categoryItem ? resolveLocalised(categoryItem.name, 'en') : 'Tools';
|
||||
|
||||
const appCategoryMap: Record<string, string> = {
|
||||
'portrait-retouch': 'PhotoEditor',
|
||||
'restoration': 'PhotoEditor',
|
||||
'background-cutout': 'GraphicDesignSoftware',
|
||||
'creative-art': 'MultimediaApplication',
|
||||
};
|
||||
const applicationCategory = appCategoryMap[tool.category] || 'MultimediaApplication';
|
||||
const ratingValue = tool.seo?.ratingValue || 4.9;
|
||||
const reviewCount = tool.seo?.reviewCount || 1420;
|
||||
|
||||
// 1. SoftwareApplication & WebApplication Rich Schema
|
||||
const softwareSchema: any = {
|
||||
'@context': 'https://schema.org',
|
||||
'@type': ['SoftwareApplication', 'WebApplication'],
|
||||
name: toolName,
|
||||
alternateName: cleanTitle,
|
||||
headline: cleanTitle,
|
||||
description: seoDescription,
|
||||
applicationCategory: applicationCategory,
|
||||
operatingSystem: 'All (Web Browser, iOS, Android)',
|
||||
url: `${siteUrl}/tools/${tool.slug}`,
|
||||
image: ogImgUrl,
|
||||
screenshot: ogImgUrl,
|
||||
offers: {
|
||||
'@type': 'Offer',
|
||||
price: '0',
|
||||
priceCurrency: 'USD',
|
||||
availability: 'https://schema.org/InStock',
|
||||
description: 'Free online trial without signup',
|
||||
},
|
||||
aggregateRating: {
|
||||
'@type': 'AggregateRating',
|
||||
ratingValue: ratingValue.toFixed(1),
|
||||
reviewCount: reviewCount,
|
||||
bestRating: '5',
|
||||
worstRating: '1',
|
||||
},
|
||||
creator: {
|
||||
'@type': 'Organization',
|
||||
name: 'CRE Innovations',
|
||||
url: siteUrl,
|
||||
},
|
||||
publisher: {
|
||||
'@type': 'Organization',
|
||||
name: 'CRE Innovations',
|
||||
url: siteUrl,
|
||||
},
|
||||
};
|
||||
|
||||
if (tool.content?.alternatingFeatures?.length) {
|
||||
softwareSchema.featureList = tool.content.alternatingFeatures.map((f) => resolveLocalised(f.title, 'en'));
|
||||
}
|
||||
|
||||
// 2. BreadcrumbList Schema
|
||||
const breadcrumbSchema = {
|
||||
'@context': 'https://schema.org',
|
||||
'@type': 'BreadcrumbList',
|
||||
itemListElement: [
|
||||
{
|
||||
'@type': 'ListItem',
|
||||
position: 1,
|
||||
name: 'Home',
|
||||
item: siteUrl,
|
||||
},
|
||||
},
|
||||
{
|
||||
{
|
||||
'@type': 'ListItem',
|
||||
position: 2,
|
||||
name: 'All Tools',
|
||||
item: `${siteUrl}/tools`,
|
||||
},
|
||||
{
|
||||
'@type': 'ListItem',
|
||||
position: 3,
|
||||
name: categoryName,
|
||||
item: `${siteUrl}/tools?category=${tool.category}`,
|
||||
},
|
||||
{
|
||||
'@type': 'ListItem',
|
||||
position: 4,
|
||||
name: toolName,
|
||||
item: `${siteUrl}/tools/${tool.slug}`,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
// 3. HowTo Rich Schema
|
||||
let howToSchema: any = null;
|
||||
if (tool.content?.steps && tool.content.steps.length > 0) {
|
||||
howToSchema = {
|
||||
'@context': 'https://schema.org',
|
||||
'@type': 'BreadcrumbList',
|
||||
itemListElement: [
|
||||
{
|
||||
'@type': 'ListItem',
|
||||
position: 1,
|
||||
name: 'Home',
|
||||
item: siteUrl,
|
||||
'@type': 'HowTo',
|
||||
name: `How to Use ${toolName} Online`,
|
||||
description: `Step-by-step guide on using ${toolName} online for free with lossless HD export.`,
|
||||
image: ogImgUrl,
|
||||
step: tool.content.steps.map((step, idx) => ({
|
||||
'@type': 'HowToStep',
|
||||
position: idx + 1,
|
||||
name: resolveLocalised(step.title, 'en'),
|
||||
text: resolveLocalised(step.desc, 'en'),
|
||||
url: `${siteUrl}/tools/${tool.slug}#step-${idx + 1}`,
|
||||
})),
|
||||
};
|
||||
}
|
||||
|
||||
// 4. FAQPage Rich Schema
|
||||
let faqSchema: any = null;
|
||||
if (tool.content?.faqs && tool.content.faqs.length > 0) {
|
||||
faqSchema = {
|
||||
'@context': 'https://schema.org',
|
||||
'@type': 'FAQPage',
|
||||
mainEntity: tool.content.faqs.map((faq) => ({
|
||||
'@type': 'Question',
|
||||
name: faq.q,
|
||||
acceptedAnswer: {
|
||||
'@type': 'Answer',
|
||||
text: faq.a,
|
||||
},
|
||||
{
|
||||
'@type': 'ListItem',
|
||||
position: 2,
|
||||
name: 'Tools',
|
||||
item: `${siteUrl}/tools`,
|
||||
},
|
||||
{
|
||||
'@type': 'ListItem',
|
||||
position: 3,
|
||||
name: toolName,
|
||||
item: `${siteUrl}/tools/${tool.slug}`,
|
||||
},
|
||||
],
|
||||
},
|
||||
})),
|
||||
};
|
||||
}
|
||||
|
||||
const structuredData = [
|
||||
softwareSchema,
|
||||
breadcrumbSchema,
|
||||
...(howToSchema ? [howToSchema] : []),
|
||||
...(faqSchema ? [faqSchema] : []),
|
||||
];
|
||||
|
||||
return (
|
||||
|
||||
+109
-5
@@ -1,15 +1,74 @@
|
||||
import { Metadata } from 'next';
|
||||
import { getPageConfig, getAllTools, getAllApps, getAllCategories } from '@/lib/config/loader';
|
||||
import { getPageConfig, getAllTools, getAllApps, getAllCategories, getSiteConfig } from '@/lib/config/loader';
|
||||
import { SectionRenderer } from '@/components/sections/SectionRenderer';
|
||||
import { notFound } from 'next/navigation';
|
||||
import { resolveLocalised } from '@/types';
|
||||
|
||||
export const dynamic = 'force-dynamic';
|
||||
export const revalidate = 0;
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: 'All AI Photo Tools | Free Online Directory',
|
||||
description: 'Browse all free online AI photo editing tools: blemish remover, background cutout, photo enhancer, old photo restorer, and anime avatars.',
|
||||
};
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
const siteConfig = getSiteConfig();
|
||||
const siteUrl = (process.env.SITE_URL || siteConfig.seo.siteUrl || 'http://localhost:3000').replace(/\/$/, '');
|
||||
|
||||
const title = 'All AI Photo Tools & Creative Studio - 80+ Free Online Tools';
|
||||
const description = 'Explore 80+ free online AI photo editing tools: blemish remover, background cutout, 4K photo enhancer, vintage photo restorer, and anime avatars. No signup, no watermarks.';
|
||||
|
||||
return {
|
||||
title,
|
||||
description,
|
||||
keywords: [
|
||||
'ai photo editor online',
|
||||
'free photo tools',
|
||||
'ai blemish remover',
|
||||
'background remover transparent png',
|
||||
'photo enhancer 4k',
|
||||
'old photo restorer',
|
||||
'ai face swap',
|
||||
'teeth whitener photo',
|
||||
'anime avatar maker',
|
||||
'CRE Innovations studio'
|
||||
],
|
||||
alternates: {
|
||||
canonical: `${siteUrl}/tools`,
|
||||
},
|
||||
openGraph: {
|
||||
title: `${title} | CRE Innovations`,
|
||||
description,
|
||||
url: `${siteUrl}/tools`,
|
||||
siteName: 'CRE Innovations',
|
||||
locale: 'en_US',
|
||||
type: 'website',
|
||||
images: [
|
||||
{
|
||||
url: `${siteUrl}/brand/og-default.png`,
|
||||
width: 1200,
|
||||
height: 630,
|
||||
alt: 'CRE Innovations - All AI Photo Tools Directory',
|
||||
},
|
||||
],
|
||||
},
|
||||
twitter: {
|
||||
card: 'summary_large_image',
|
||||
title: `${title} | CRE Innovations`,
|
||||
description,
|
||||
images: [`${siteUrl}/brand/og-default.png`],
|
||||
creator: '@CREInnovations',
|
||||
site: '@CREInnovations',
|
||||
},
|
||||
robots: {
|
||||
index: true,
|
||||
follow: true,
|
||||
googleBot: {
|
||||
index: true,
|
||||
follow: true,
|
||||
'max-video-preview': -1,
|
||||
'max-image-preview': 'large',
|
||||
'max-snippet': -1,
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export default function ToolsIndexPage() {
|
||||
const page = getPageConfig('tools');
|
||||
@@ -18,6 +77,8 @@ export default function ToolsIndexPage() {
|
||||
const tools = getAllTools();
|
||||
const apps = getAllApps();
|
||||
const categories = getAllCategories();
|
||||
const siteConfig = getSiteConfig();
|
||||
const siteUrl = (process.env.SITE_URL || siteConfig.seo.siteUrl || 'http://localhost:3000').replace(/\/$/, '');
|
||||
|
||||
const context = {
|
||||
page,
|
||||
@@ -27,8 +88,51 @@ export default function ToolsIndexPage() {
|
||||
locale: 'en',
|
||||
};
|
||||
|
||||
// Structured Data (JSON-LD) for CollectionPage & ItemList
|
||||
const structuredData = [
|
||||
{
|
||||
'@context': 'https://schema.org',
|
||||
'@type': 'CollectionPage',
|
||||
name: 'All AI Photo Tools & Creative Studio',
|
||||
description: 'Comprehensive directory of 80+ online AI vision and photo editing tools.',
|
||||
url: `${siteUrl}/tools`,
|
||||
mainEntity: {
|
||||
'@type': 'ItemList',
|
||||
itemListElement: tools.map((tool, idx) => ({
|
||||
'@type': 'ListItem',
|
||||
position: idx + 1,
|
||||
name: resolveLocalised(tool.name, 'en'),
|
||||
url: `${siteUrl}/tools/${tool.slug}`,
|
||||
description: tool.seo?.description || resolveLocalised(tool.summary, 'en'),
|
||||
})),
|
||||
},
|
||||
},
|
||||
{
|
||||
'@context': 'https://schema.org',
|
||||
'@type': 'BreadcrumbList',
|
||||
itemListElement: [
|
||||
{
|
||||
'@type': 'ListItem',
|
||||
position: 1,
|
||||
name: 'Home',
|
||||
item: siteUrl,
|
||||
},
|
||||
{
|
||||
'@type': 'ListItem',
|
||||
position: 2,
|
||||
name: 'All AI Tools',
|
||||
item: `${siteUrl}/tools`,
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<div>
|
||||
<script
|
||||
type="application/ld+json"
|
||||
dangerouslySetInnerHTML={{ __html: JSON.stringify(structuredData) }}
|
||||
/>
|
||||
{page.sections.map((section) => (
|
||||
<SectionRenderer key={section.id} section={section} context={context} />
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user