// ============================================================================ // SEO - Meta tags dinamicas por pagina // ============================================================================ // Uso: // // Cada pagina deve usar este componente com suas proprias tags. // O canonical e gerado automaticamente a partir da URL atual. // ============================================================================ import { Helmet } from 'react-helmet-async'; import { useLocation } from 'react-router-dom'; import { ENV_CONFIG } from '../config/environment'; interface SEOProps { title?: string; description?: string; keywords?: string; ogImage?: string; ogType?: string; noindex?: boolean; // Se true, forca noindex mesmo em producao schema?: Record; } const SITE_URL = 'https://avanzato.com.br'; const DEFAULT_TITLE = 'Avanzato Tecnologia | TI Gerenciada, Cloud e Seguranca'; const DEFAULT_DESC = 'Solucoes em TI Gerenciada, Cloud Computing e Seguranca da Informacao. +23 anos de experiencia, +500 clientes atendidos. Suporte 24/7 em Guarulhos e regiao.'; const DEFAULT_OG_IMAGE = 'https://avanzato.com.br/og-image.jpg'; export default function SEO({ title, description, keywords, ogImage, ogType = 'website', noindex = false, schema, }: SEOProps) { const location = useLocation(); const pathname = location.pathname; const canonicalUrl = `${SITE_URL}${pathname}`; const fullTitle = title ? `${title} | Avanzato` : DEFAULT_TITLE; return ( {/* Title */} {fullTitle} {/* Description */} {description && } {!description && } {/* Keywords */} {keywords && } {/* Canonical - DINAMICO por pagina */} {/* Robots - automatico por ambiente, override com prop noindex */} {noindex || !ENV_CONFIG.allowIndexing ? ( ) : ( )} {/* Open Graph */} {/* Twitter */} {/* Schema.org */} {schema && ( )} ); } // Schema helpers export const createServiceSchema = (name: string, description: string, urlPath: string) => ({ '@context': 'https://schema.org', '@type': 'Service', name, description, provider: { '@type': 'Organization', name: 'Avanzato Tecnologia', url: SITE_URL, }, url: `${SITE_URL}${urlPath}`, areaServed: { '@type': 'City', name: 'Guarulhos', }, }); export const createFAQSchema = (questions: Array<{q: string; a: string}>) => ({ '@context': 'https://schema.org', '@type': 'FAQPage', mainEntity: questions.map(({q, a}) => ({ '@type': 'Question', name: q, acceptedAnswer: { '@type': 'Answer', text: a, }, })), });