| | |
| | | protected function getMetaFor(string $type): array |
| | | { |
| | | $default = $this->registry->getDefaultMetaValues(); |
| | | |
| | | // Check if content/taxonomy config has SEO meta defined |
| | | $configMeta = $this->getDefaultConfig($type, 'meta'); |
| | | if (!empty($configMeta)) { |
| | | $configMeta = $this->normalizeMetaKeys($configMeta); |
| | | $default = array_merge($default, $configMeta); |
| | | } |
| | | |
| | | return get_option($this->metaKey, $default); |
| | | } |
| | | |
| | | /** |
| | | * Normalize content-defined meta keys to system keys |
| | | */ |
| | | private function normalizeMetaKeys(array $meta): array |
| | | { |
| | | $map = [ |
| | | 'title' => 'metaTitle', |
| | | 'description' => 'metaDescription', |
| | | ]; |
| | | |
| | | $normalized = []; |
| | | foreach ($meta as $key => $value) { |
| | | $normalized[$map[$key] ?? $key] = $value; |
| | | } |
| | | return $normalized; |
| | | } |
| | | |
| | | /** |
| | | * Get default schema configuration for a type |
| | | */ |
| | | protected function getConfigFor(string $type): array |