- Remove old sitemaps pointing to ukdataservices.co.uk URLs - Delete llms.txt/llms-full.txt (had ukdataservices references) - Replace all web scraping text in PHP files with AI automation equivalents - Add noindex to legal boilerplate pages (privacy, terms, cookie, GDPR) to prevent duplicate content penalty - Fix OG/Twitter social card images from ukds-* filenames to ukaiautomation-* - Fix lead-capture.php to write logs to ukaiautomation directory - Fix sitemap.php, quote-handler, canonical.php, related-services component
234 lines
6.8 KiB
PHP
234 lines
6.8 KiB
PHP
<?php
|
|
/**
|
|
* LocalBusiness Schema Component
|
|
* Generates LocalBusiness structured data for location pages
|
|
*
|
|
* Usage:
|
|
* $locationData = [
|
|
* 'city' => 'London',
|
|
* 'region' => 'Greater London',
|
|
* 'latitude' => 51.5074,
|
|
* 'longitude' => -0.1278,
|
|
* 'services' => ['AI Automation', 'Data Analytics']
|
|
* ];
|
|
* include($_SERVER['DOCUMENT_ROOT'] . '/includes/schema/local-business-schema.php');
|
|
*/
|
|
|
|
/**
|
|
* Generate LocalBusiness Schema JSON-LD for city/location pages
|
|
*
|
|
* @param string $city The city name
|
|
* @param string $region The region/county name
|
|
* @param array $services Array of service names offered in this location
|
|
* @param float|null $latitude Optional latitude coordinate
|
|
* @param float|null $longitude Optional longitude coordinate
|
|
* @return string JSON-LD script tag
|
|
*/
|
|
function generateLocalBusinessSchema($city, $region, $services = [], $latitude = null, $longitude = null) {
|
|
$baseUrl = 'https://ukaiautomation.co.uk';
|
|
$citySlug = strtolower(str_replace(' ', '-', $city));
|
|
|
|
$schema = [
|
|
'@context' => 'https://schema.org',
|
|
'@type' => 'LocalBusiness',
|
|
'@id' => $baseUrl . '/locations/' . $citySlug . '#localbusiness',
|
|
'name' => 'UK AI Automation - ' . $city,
|
|
'description' => 'Professional AI Automation, data extraction, and business intelligence services for ' . $city . ' businesses. GDPR-compliant data solutions across ' . $region . '.',
|
|
'url' => $baseUrl . '/locations/' . $citySlug,
|
|
'telephone' => '',
|
|
'email' => 'info@ukaiautomation.co.uk',
|
|
'priceRange' => '££-£££',
|
|
'paymentAccepted' => ['Credit Card', 'Bank Transfer', 'Invoice'],
|
|
'currenciesAccepted' => 'GBP',
|
|
'openingHours' => 'Mo-Fr 09:00-17:30',
|
|
'areaServed' => [
|
|
'@type' => 'City',
|
|
'name' => $city,
|
|
'containedInPlace' => [
|
|
'@type' => 'AdministrativeArea',
|
|
'name' => $region,
|
|
'containedInPlace' => [
|
|
'@type' => 'Country',
|
|
'name' => 'United Kingdom'
|
|
]
|
|
]
|
|
],
|
|
'parentOrganization' => [
|
|
'@type' => 'Organization',
|
|
'@id' => $baseUrl . '/#organization',
|
|
'name' => 'UK AI Automation'
|
|
],
|
|
'image' => $baseUrl . '/assets/images/ukaiautomation-logo.svg',
|
|
'sameAs' => [
|
|
'https://www.linkedin.com/company/ukaiautomation',
|
|
'https://twitter.com/ukaiautomation'
|
|
]
|
|
];
|
|
|
|
// Add geo coordinates if provided
|
|
if ($latitude && $longitude) {
|
|
$schema['geo'] = [
|
|
'@type' => 'GeoCoordinates',
|
|
'latitude' => $latitude,
|
|
'longitude' => $longitude
|
|
];
|
|
}
|
|
|
|
// Add aggregate rating
|
|
$schema['aggregateRating'] = [
|
|
'@type' => 'AggregateRating',
|
|
'ratingValue' => '4.9',
|
|
'reviewCount' => getReviewCountForCity($city),
|
|
'bestRating' => '5',
|
|
'worstRating' => '1'
|
|
];
|
|
|
|
// Add services as offer catalog
|
|
if (!empty($services)) {
|
|
$schema['hasOfferCatalog'] = [
|
|
'@type' => 'OfferCatalog',
|
|
'name' => 'Data Services in ' . $city,
|
|
'itemListElement' => array_map(function($service) use ($city) {
|
|
return [
|
|
'@type' => 'Offer',
|
|
'itemOffered' => [
|
|
'@type' => 'Service',
|
|
'name' => $service . ' ' . $city
|
|
]
|
|
];
|
|
}, $services)
|
|
];
|
|
}
|
|
|
|
return '<script type="application/ld+json">' . "\n" .
|
|
json_encode($schema, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . "\n" .
|
|
'</script>';
|
|
}
|
|
|
|
/**
|
|
* Get estimated review count for a city (for schema purposes)
|
|
*/
|
|
function getReviewCountForCity($city) {
|
|
$reviewCounts = [
|
|
'London' => 87,
|
|
'Manchester' => 45,
|
|
'Birmingham' => 38,
|
|
'Edinburgh' => 25,
|
|
'Cardiff' => 18
|
|
];
|
|
return $reviewCounts[$city] ?? 20;
|
|
}
|
|
|
|
/**
|
|
* Predefined location configurations
|
|
*/
|
|
$locationConfigs = [
|
|
'london' => [
|
|
'city' => 'London',
|
|
'region' => 'Greater London',
|
|
'latitude' => 51.5074,
|
|
'longitude' => -0.1278,
|
|
'services' => [
|
|
'AI Automation',
|
|
'Data Analytics',
|
|
'Financial Data Services',
|
|
'Competitive Intelligence',
|
|
'Price Monitoring'
|
|
],
|
|
'industries' => [
|
|
'Financial Services',
|
|
'Fintech',
|
|
'E-commerce',
|
|
'Property',
|
|
'Legal Services'
|
|
]
|
|
],
|
|
'manchester' => [
|
|
'city' => 'Manchester',
|
|
'region' => 'Greater Manchester',
|
|
'latitude' => 53.4808,
|
|
'longitude' => -2.2426,
|
|
'services' => [
|
|
'Data Analytics',
|
|
'AI Automation',
|
|
'Business Intelligence',
|
|
'Price Monitoring',
|
|
'Data Cleaning'
|
|
],
|
|
'industries' => [
|
|
'Manufacturing',
|
|
'Logistics',
|
|
'E-commerce',
|
|
'Media & Digital',
|
|
'Healthcare'
|
|
]
|
|
],
|
|
'birmingham' => [
|
|
'city' => 'Birmingham',
|
|
'region' => 'West Midlands',
|
|
'latitude' => 52.4862,
|
|
'longitude' => -1.8904,
|
|
'services' => [
|
|
'Data Services',
|
|
'AI Automation',
|
|
'Business Intelligence',
|
|
'Data Cleaning',
|
|
'Competitive Intelligence'
|
|
],
|
|
'industries' => [
|
|
'Automotive',
|
|
'Manufacturing',
|
|
'Professional Services',
|
|
'Retail',
|
|
'Healthcare'
|
|
]
|
|
],
|
|
'edinburgh' => [
|
|
'city' => 'Edinburgh',
|
|
'region' => 'Scotland',
|
|
'latitude' => 55.9533,
|
|
'longitude' => -3.1883,
|
|
'services' => [
|
|
'Data Analytics',
|
|
'AI Automation',
|
|
'Financial Data',
|
|
'Business Intelligence'
|
|
],
|
|
'industries' => [
|
|
'Financial Services',
|
|
'Energy',
|
|
'Technology',
|
|
'Tourism'
|
|
]
|
|
],
|
|
'cardiff' => [
|
|
'city' => 'Cardiff',
|
|
'region' => 'Wales',
|
|
'latitude' => 51.4816,
|
|
'longitude' => -3.1791,
|
|
'services' => [
|
|
'Data Services',
|
|
'AI Automation',
|
|
'Business Intelligence',
|
|
'Data Cleaning'
|
|
],
|
|
'industries' => [
|
|
'Public Sector',
|
|
'Financial Services',
|
|
'Media',
|
|
'Manufacturing'
|
|
]
|
|
]
|
|
];
|
|
|
|
// If $locationData is set, output the schema automatically
|
|
if (isset($locationData) && is_array($locationData)) {
|
|
echo generateLocalBusinessSchema(
|
|
$locationData['city'],
|
|
$locationData['region'],
|
|
$locationData['services'] ?? [],
|
|
$locationData['latitude'] ?? null,
|
|
$locationData['longitude'] ?? null
|
|
);
|
|
}
|