Jake Vanderwerf
2025-12-21 3aada9949d51024a92a8b5c6cb70d12f9c3cac16
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<?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' => [
                'additionalType' => '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',
            ]
        ]
    ]
];
 
**/