- Refactored navigation: all 44 pages now use shared includes/nav.php - Added Free Tools link to navigation (was missing from 29+ pages) - CSS readability: darker body text (#333), secondary text (#555), bolder hero subtitle - CSS: darkened link colour (#148a72) for WCAG AA compliance - CSS: increased stat label font size to 1rem - Fixed industry-card hover white-on-white text bug - Removed ICO Registered and Cyber Essentials claims (not yet registered) - Cache version bumped to v1.1.2
53 lines
1.2 KiB
PHP
53 lines
1.2 KiB
PHP
<?php
|
|
/**
|
|
* Breadcrumb Schema Component
|
|
* Generates BreadcrumbList structured data for improved SEO
|
|
*
|
|
* Usage: Set $breadcrumbs array before including this file
|
|
* Example:
|
|
* $breadcrumbs = [
|
|
* ['url' => '/', 'label' => 'Home'],
|
|
* ['url' => '/blog', 'label' => 'Blog'],
|
|
* ['url' => '', 'label' => 'Current Page Title']
|
|
* ];
|
|
*/
|
|
|
|
if (!isset($breadcrumbs) || empty($breadcrumbs)) {
|
|
return;
|
|
}
|
|
|
|
$base_url = 'https://ukdataservices.co.uk';
|
|
$items = [];
|
|
|
|
foreach ($breadcrumbs as $index => $crumb) {
|
|
$position = $index + 1;
|
|
$item = [
|
|
'@type' => 'ListItem',
|
|
'position' => $position,
|
|
'name' => $crumb['label']
|
|
];
|
|
|
|
// Add URL for all items except the last one (current page)
|
|
if (!empty($crumb['url'])) {
|
|
$url = $crumb['url'];
|
|
// Ensure URL is absolute
|
|
if (strpos($url, 'http') !== 0) {
|
|
$url = $base_url . $url;
|
|
}
|
|
$item['item'] = $url;
|
|
}
|
|
|
|
$items[] = $item;
|
|
}
|
|
|
|
$schema = [
|
|
'@context' => 'https://schema.org',
|
|
'@type' => 'BreadcrumbList',
|
|
'itemListElement' => $items
|
|
];
|
|
?>
|
|
|
|
<script type="application/ld+json">
|
|
<?php echo json_encode($schema, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); ?>
|
|
</script>
|