SYS ONLINESVR sao-paulo-01EDITION 02/2026▓▒░ ░▒▓UTC-3

Gerador de Schema.org LocalBusiness

Preencha os campos e copie o JSON-LD pronto para colar no <head> da sua página. Sem cadastro, sem pedágio — a ferramenta roda aqui mesmo.

obrigatório
obrigatório
Endereço

JSON-LD gerado

application/ld+json
1{
2 "@context": "https://schema.org",
3 "@type": "LocalBusiness",
4 "address": {
5 "@type": "PostalAddress"
6 }
7}
Validar no Rich Results Test

Código do gerador

A mesma função que roda acima — baixe e use no seu build.

schema-generator.js
1// schema-generator.js
2// Pure, framework-agnostic builder for Schema.org LocalBusiness JSON-LD.
3// Same function powers the live tool at eduardomendes.com.br/repo/schema and
4// this downloadable module — no divergence.
5//
6// Usage:
7// import { buildSchema } from "./schema-generator.js";
8// const jsonld = buildSchema({ type: "Dentist", name: "...", ... });
9// console.log(JSON.stringify(jsonld, null, 2));
10/** Specific @type values that all inherit from LocalBusiness. */ export const BUSINESS_TYPES = [
11 "LocalBusiness",
12 "Dentist",
13 "LegalService",
14 "Restaurant",
15 "HomeAndConstructionBusiness"
16];
17/** Drop empty strings / empty arrays so the output stays clean. */ function clean(value) {
18 if (Array.isArray(value)) {
19 const arr = value.map(clean).filter((v)=>v !== undefined && v !== "" && !(Array.isArray(v) && v.length === 0));
20 return arr.length ? arr : undefined;
21 }
22 if (value && typeof value === "object") {
23 const out = {};
24 for (const [k, v] of Object.entries(value)){
25 const c = clean(v);
26 if (c !== undefined && c !== "") out[k] = c;
27 }
28 return Object.keys(out).length ? out : undefined;
29 }
30 if (typeof value === "string") return value.trim() || undefined;
31 return value;
32}
33/**
34 * @param {object} data
35 * @param {string} data.type One of BUSINESS_TYPES
36 * @param {string} data.name Business name (required)
37 * @param {string} [data.description]
38 * @param {string} [data.url]
39 * @param {string} [data.telephone]
40 * @param {string} [data.priceRange]
41 * @param {object} [data.address] { street, locality, region, postalCode, country }
42 * @param {object} [data.geo] { lat, lng }
43 * @param {string[]} [data.areaServed]
44 * @param {string[]} [data.sameAs]
45 * @param {string[]} [data.services] Service names offered
46 * @returns {object} JSON-LD object
47 */ export function buildSchema(data = {}) {
48 const type = BUSINESS_TYPES.includes(data.type) ? data.type : "LocalBusiness";
49 const address = data.address ? {
50 "@type": "PostalAddress",
51 streetAddress: data.address.street,
52 addressLocality: data.address.locality,
53 addressRegion: data.address.region,
54 postalCode: data.address.postalCode,
55 addressCountry: data.address.country
56 } : undefined;
57 const geo = data.geo && (data.geo.lat || data.geo.lng) ? {
58 "@type": "GeoCoordinates",
59 latitude: data.geo.lat,
60 longitude: data.geo.lng
61 } : undefined;
62 const services = Array.isArray(data.services) ? data.services.map((s)=>typeof s === "string" ? s.trim() : "").filter(Boolean).map((name)=>({
63 "@type": "Offer",
64 itemOffered: {
65 "@type": "Service",
66 name
67 }
68 })) : undefined;
69 const schema = {
70 "@context": "https://schema.org",
71 "@type": type,
72 name: data.name,
73 description: data.description,
74 url: data.url,
75 telephone: data.telephone,
76 priceRange: data.priceRange,
77 address,
78 geo,
79 areaServed: Array.isArray(data.areaServed) ? data.areaServed.map((a)=>typeof a === "string" ? a.trim() : "").filter(Boolean) : undefined,
80 sameAs: Array.isArray(data.sameAs) ? data.sameAs.map((s)=>typeof s === "string" ? s.trim() : "").filter(Boolean) : undefined,
81 makesOffer: services
82 };
83 return clean(schema) || {
84 "@context": "https://schema.org",
85 "@type": type
86 };
87}
88/** Which fields are required for a valid, useful result. */ export function validate(data = {}) {
89 const errors = {};
90 if (!data.name || !data.name.trim()) errors.name = "required";
91 if (!data.url || !data.url.trim()) errors.url = "required";
92 if (data.url && data.url.trim() && !/^https?:\/\//i.test(data.url.trim())) errors.url = "must start with http(s)://";
93 return errors;
94}

Perguntas frequentes

Onde eu coloco o código gerado?

Dentro de uma tag <script type="application/ld+json"> no <head> (ou no fim do <body>) da página que descreve o negócio.

Qual @type devo escolher?

Use o mais específico que descreve você: Dentist, LegalService, Restaurant ou HomeAndConstructionBusiness. Todos herdam de LocalBusiness, então na dúvida use LocalBusiness.

Isso garante rich results no Google?

Não há garantia — o schema torna a página elegível. Valide sempre no Rich Results Test e mantenha os dados consistentes com o que aparece na página.