<?php
|
/**
|
* JVB_SCHEMA: Site-wide schema configuration
|
*
|
* Structure:
|
* - business: LocalBusiness/Organization for home page
|
* - website: WebSite schema configuration
|
* - actions: PotentialAction definitions
|
* - attribution: Developer/maintainer info
|
*/
|
|
use JVBase\managers\SEO\SchemaBuilder;
|
|
$schema = apply_filters('jvb_schema', []);
|
$registry = SchemaBuilder::getInstance();
|
$checked = [];
|
foreach ($schema as $key => $config) {
|
|
if (array_key_exists('type', $config)) {
|
$type = $config['type'];
|
} elseif ($key === 'website') {
|
$type = 'WebSite';
|
}
|
$exists = !is_null($registry->getTypeDefinition($type));
|
if (!$exists) {
|
// error_log('[JVB_SCHEMA] No definitions for: '.print_r($type, true));
|
continue;
|
}
|
$allowed = $registry->getFieldsForType($type);
|
$filtered = array_filter($config, function ($item) use ($allowed) {
|
return in_array($item, $allowed);
|
}, ARRAY_FILTER_USE_KEY);
|
|
if (empty($filtered)) {
|
// error_log('[JVB_SCHEMA] No valid filters for '.$type.'.');
|
continue;
|
}
|
$removed = array_filter($config, function ($item) use ($allowed) {
|
return !in_array($item, $allowed);
|
}, ARRAY_FILTER_USE_KEY);
|
|
if (!empty($removed)) {
|
// error_log('[JVB_SCHEMA] Invalid fields detected for '.$type.': '.print_r($removed, true));
|
}
|
$checked[$key] = $filtered;
|
}
|
|
define('JVB_SCHEMA', $checked);
|
|
|
/**
|
JVB_CONTENT['artwork'] = [
|
'singular' => 'Artwork',
|
'plural' => 'Artworks',
|
// ... other config
|
|
'seo' => [
|
'meta' => [
|
'title' => '{{post_title}} by {{linked_user.display_name}} | {{site_title}}',
|
'description' => '{{style.primary.name}} artwork by {{linked_user.display_name}}. {{short_bio|default:View this piece and more.}}',
|
'archive_title' => 'Artwork Gallery',
|
'archive_description' => 'Browse our collection of tattoo artwork and designs.',
|
],
|
'schema' => [
|
'type' => 'VisualArtwork',
|
'mappings' => [
|
'artform' => 'style.primary', // DefinedTerm from taxonomy
|
'creator' => 'linked_user', // Person from linked user
|
'image' => 'featured_image', // ImageObject
|
'artMedium' => 'medium.names:3', // Comma-separated term names
|
],
|
'overrides' => [
|
'inLanguage' => 'en',
|
]
|
]
|
]
|
];
|
|
JVB_CONTENT['artist'] = [
|
'singular' => 'Artist',
|
'plural' => 'Artists',
|
|
'seo' => [
|
'meta' => [
|
'title' => '{{post_title}} - {{artist_type|default:Tattoo Artist}} in {{city.primary.name|default:Edmonton}}',
|
'description' => '{{short_bio|truncate:155}}',
|
],
|
'schema' => [
|
'type' => 'Person',
|
'mappings' => [
|
'image' => 'image_portrait',
|
'jobTitle' => 'artist_type',
|
'worksFor' => 'shop.primary', // LocalBusiness reference
|
'knowsAbout' => 'style.names', // Array of style names
|
'areaServed' => 'city.primary.name',
|
]
|
]
|
]
|
];
|
|
JVB_TAXONOMY['shop'] = [
|
'singular' => 'Shop',
|
'plural' => 'Shops',
|
|
'seo' => [
|
'meta' => [
|
'title' => '{{term_name}} - Tattoo Shop in {{city.primary.name|default:Edmonton}}',
|
'description' => '{{tagline|default:Visit}} {{term_name}}. {{short_bio|truncate:120}}',
|
],
|
'schema' => [
|
'type' => 'TattooParlor', // or LocalBusiness
|
'mappings' => [
|
'address' => 'location',
|
'telephone' => 'phone',
|
'email' => 'email',
|
'openingHoursSpecification' => 'hours',
|
'image' => 'image',
|
'priceRange' => 'price_range',
|
'paymentAccepted' => 'payment_accepted',
|
],
|
'overrides' => [
|
'additionalTypeTrait' => 'https://schema.org/TattooParlor',
|
]
|
]
|
]
|
];
|
|
JVB_TAXONOMY['style'] = [
|
'singular' => 'Style',
|
'plural' => 'Styles',
|
|
'seo' => [
|
'meta' => [
|
'title' => '{{term_name}} Tattoos in Edmonton | {{site_title}}',
|
'description' => '{{tagline|default:Explore}} {{term_name}} tattoo artists and designs. {{characteristics|strip|truncate:100}}',
|
],
|
'schema' => [
|
'type' => 'DefinedTerm',
|
'mappings' => [
|
'alternateName' => 'alternate_name',
|
]
|
]
|
]
|
];
|
|
**/
|