| | |
| | | |
| | | protected array $properties = []; |
| | | protected array $referenceProperties = []; |
| | | protected array $extras = []; |
| | | protected array $defaultReference = [ |
| | | 'name' => '{{post_title}}', |
| | | 'url' => '{{post_permalink}}', |
| | |
| | | } |
| | | $this->defaultArchive['description'] = '{{registrar.'.$slug.'.description}}'; |
| | | } |
| | | |
| | | $this->extras = apply_filters(BASE.ucfirst($slug).'Extras', []); |
| | | $this->initFilters(); |
| | | $this->registerHooks(); |
| | | } |
| | |
| | | |
| | | $class = JVB()->schemaHelper()::classFromConfig($config, $meta); |
| | | $class->setAuthor(JVB()->seo()->getCreator(true)); |
| | | |
| | | $class = apply_filters('jvb_single_'.$this->slug.'_schema_output', $class, $ID); |
| | | return $class->outputSchema(); |
| | | } |
| | | ); |
| | |
| | | $class->setMainEntity($itemList); |
| | | |
| | | $schema = $class->outputSchema(); |
| | | error_log('Generated archive schema: '.print_r($schema, true)); |
| | | |
| | | if (JVB_TESTING) { |
| | | // error_log('Generated archive schema: '.print_r($schema, true)); |
| | | } |
| | | |
| | | return $schema; |
| | | } |
| | | ); |
| | |
| | | error_log('[SEO]Schema::getConfig Invalid type: '.$type); |
| | | return []; |
| | | } |
| | | jvbDump($this->slug); |
| | | jvbDump($type); |
| | | return JVB()->schemaHelper()::getConfig($this->slug, $type); |
| | | } |
| | | |
| | |
| | | $title = Resolver::resolve($config['name']??$config['title']??'', $meta); |
| | | } elseif (is_post_type_archive($based) ) { |
| | | $config = $this->getConfig('archive'); |
| | | $title = $config['name']; |
| | | $title = Resolver::resolve($config['name'], null); |
| | | } elseif (is_tax($based)) { |
| | | $config = $this->getConfig('archive'); |
| | | $meta = Meta::forTerm(get_queried_object_id()); |
| | |
| | | $page->setMainEntity($termset); |
| | | return $page->outputSchema(); |
| | | } |
| | | |
| | | public function extra():array |
| | | { |
| | | if (empty($this->extras)) { |
| | | return []; |
| | | } |
| | | $out = []; |
| | | foreach ($this->extras as $config) { |
| | | $schema = SchemaHelper::classFromConfig($config); |
| | | $output = $schema->outputSchema(); |
| | | if (!empty($output)) { |
| | | $out[] = $output; |
| | | } |
| | | } |
| | | return $out; |
| | | } |
| | | } |