From d7e7d248cbe41cd7a9ef9c2fb022b6c4831f99a3 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Sun, 31 May 2026 15:22:56 +0000
Subject: [PATCH] =jakevan complete
---
inc/registrar/config/seo/Schema.php | 32 +++++++++++++++++++++++++++++---
1 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/inc/registrar/config/seo/Schema.php b/inc/registrar/config/seo/Schema.php
index 85ec62d..9fc1394 100644
--- a/inc/registrar/config/seo/Schema.php
+++ b/inc/registrar/config/seo/Schema.php
@@ -23,6 +23,7 @@
protected array $properties = [];
protected array $referenceProperties = [];
+ protected array $extras = [];
protected array $defaultReference = [
'name' => '{{post_title}}',
'url' => '{{post_permalink}}',
@@ -67,6 +68,8 @@
}
$this->defaultArchive['description'] = '{{registrar.'.$slug.'.description}}';
}
+
+ $this->extras = apply_filters(BASE.ucfirst($slug).'Extras', []);
$this->initFilters();
$this->registerHooks();
}
@@ -295,7 +298,11 @@
$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;
}
);
@@ -326,7 +333,10 @@
}
$config = $this->getConfig();
$class = JVB()->schemaHelper()::classFromConfig($config, $meta);
- $class->delete('about');
+ if ($class) {
+ $class->delete('about');
+ }
+
switch ($type) {
case 'post':
@@ -440,7 +450,7 @@
$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());
@@ -656,4 +666,20 @@
$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;
+ }
}
--
Gitblit v1.10.0